0

I'm writing a custom shipping module and have an error somewhere. When loading the shopping cart it displays "Something went wrong. Please try again."

I have developer mode on so normally PHP errors would be displayed, but it seems like they are not being displaying since it is in the shipping module code. I've tested this by calling a non-existent function in my shipping PHP code and the same error message is displayed.

Nothing is logged in var/log or var/report. I cannot find any indication that the error is being logged anywhere.

Does anyone know how I can see what error is being generated?

2 Answers 2

0

To see the PHP error messages, you can check the following:

  1. Check the PHP error logs: The logs are usually located in the /var/log directory. If the error logs are not generated, you may need to adjust the PHP configuration in your server to allow logging errors.

  2. Use a developer tool like Xdebug: Xdebug is a popular PHP extension for debugging and profiling. It allows you to see the exact line where the error occurs and inspect the variables, making it easier to debug your code.

  3. Add custom error handling: You can add custom error handling to your shipping module code to catch the errors and log them for debugging purposes. To do this, you can use the set_error_handler function in PHP.

Hope this helps to debug the issue!

0

Magento in developer mode by default shows the error message on the browser. If you are still not able to see the error message then manually add the below line in the index.php file. You can find the index.php file under the /pub folder or root path of Magento.

//You can add the below code after the starting of <?PHP tag.

ini_set('display_errors', 1);
error_reporting(E_ALL);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.