ANTONIOPS Posted November 21 Share Posted November 21 Hi, Does anyone know if there’s a hook or some other way in PrestaShop to reliably capture 5xx errors and their exception messages directly from a module without needing to modify core files? I created a simple module to handle the information and I just need to find the right place, hook, or method to obtain that information. Thanks in advance for any advice! Prestashop 1.7.x or 8.x Link to comment Share on other sites More sharing options...
Prestashop Addict Posted November 21 Share Posted November 21 Hi, I don't know module but if you have programmer skills you can make it see approach sample Link to comment Share on other sites More sharing options...
ANTONIOPS Posted November 22 Author Share Posted November 22 9 hours ago, Prestashop Addict said: Hi, I don't know module but if you have programmer skills you can make it see approach sample I actually created a small module before posting this that catches all HTTP codes and sends them to a Telegram group (it first retrieves all user information if the user is registered). I had to add a reference to a PHP file from my module inside the index.php file, just like in the example you mentioned. However, I find it a bit "messy" to modify that file. The module adds this line during installation and removes it upon uninstallation. Still, I don't think a module that modifies this file would be considered a good practice 😅. Here is the line added to index.php: require_once __DIR__ . '/modules/telegramhttcodenotifier/code_handler.php'; The problem is that I still cannot catch the exception message, only the code. Being able to capture the message would save me a lot of time. Example of a message sent to Telegram: HTTP Code: 500 Method: POST Date: 2024-11-21 19:11:56 URL: {full URL where the code was caught} Customer Type: Registered Customer ID: 123456 // Shows 'Guest' if not registered Customer Email: {customer email} IP: xxx.xxx.xxx.xxx I'll take a closer look to the approach you shared just in case. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now