Wouldn't be nice to have our opencart errors reported to the wonderful Bugsnag dashboard?
This is already possible. Follow steps below.
First, download
guzzle.phar
andbugsnag.phar
. See this link for the download links: https://docs.bugsnag.com/platforms/php/other/#installationCopy these
guzzle.phar
andbugsnag.phar
to your Opencart. I copied them to:system/octv/libs
.In
index.php
andadmin/index.php
locate the error handlerset_error_handler('error_handler');
and add:
require DIR_SYSTEM . "octv/libs/guzzle.phar";
require DIR_SYSTEM . "octv/libs/bugsnag.phar";
$bugsnag = Bugsnag\Client::make("YOUR_BUGSNAG_KEY");
$registry->set('Bs', $bugsnag); //Let Bs become available in $this
//Bugsnag\Handler::register($bugsnag);
Bugsnag\Handler::registerWithPrevious($bugsnag);
Conclusion
Now as soon as an unexpected error happens in your live ecommerce site, you are notified by email, great, isn’t it?