Bugsnag Integration

Updated 10 April 2020 | Anastasia Kholod

Do you sometimes find yourself as Keanu Reeves from The Matrix in the raining down code when you forced to go through the long log files to track the users’ errors? Well, I did, and I can claim for sure that it’s not a pleasant experience at all.

However, it is always darkest before the dawn. And my daylight came when I had found Bugsnag. It’s a web platform that notifies about the errors and exceptions that occur in the service.

Previously, we had been using none of the similar solutions. The process of finding information about the errors was quite complex and daunting. We gathered all needed data during a day, week and month then processed it and automatically formed reports. They included such info as account id, store URL, response code, error message, etc. All reports were sent to clients via email with described exceptions.

The Number of our clients has been increasing and it is turned to be more and more difficult to work and deal with multiple requests in such a way. But probably the main problem that occurred was to react immediately when an error took place instead of waiting for the report. All these inconveniences have triggered for searching a solution that would help to solve the challenges and move to a higher quality level.

Bugsnag is a service that has met all our requirements. I can point out the major features that have influenced our decision:

  • there are no error limitations in a definite time (while Rollbar or Sentry has);
  • the time of storing the history of errors is longer than in other similar solutions (e.g. Rollbar and Sentry offer only 30 days while Bugsnag - 3 months);
  • reach and well-structured Bugsnag documentation includes guides and instructions on how to get out the most of the platform. It allows you to create your own notifier libraries and notification plugins;
  • Bugsnag supports various notifications beginning from the old email to pinging the team’s HipChat. Over and above, it opens a GitHub issue directly in your repository, it’s a great feature, isn’t it? And the webhook notification will ring an alarm every 5 minutes, so you surely won’t forget about an exception;
  • and the last criteria is the price that is pretty reasonable for such options.

Bugsnag Integration

As I have mentioned above, Bugsnag documentation is well-structured and outlines the best patterns on how to perform integration with the platform. The process is described in detail and in a simple way. You can add Bugsnag to your project in three ways:

bugsnag

I find this very useful and simple as you don’t have to download, unzip and paste various files. I have just used one command:

$ composer require "bugsnag/bugsnag:2.*"

A manual variant is for those who haven’t used to work with the composer.

Bug Bounty

Catching bugs in Bugsnag is quite a simple process. You have to add error and exception handlers:

set_error_handler(array($bugsnag, 'errorHandler'));
set_exception_handler(array($bugsnag, 'exceptionHandler'));

Note, if you have error and exception handlers written in your project, then keep an eye as several copies may seriously tie you up in knots.

Severity is one more useful feature that allows to set up error priority (e.g. info, error, warning). Thus, you can easily filter and fix the major of them primarily. Also, Severity will help you to separate exceptions that happened on production or development servers.

$bugsnag->setReleaseStage('development');

Also, if there is a necessity, you can indicate a user who has faced an error. In some cases, it’s highly important to contact the client immediately and help with the problem.

$bugsnag->setUser(array(
    'name' => 'Leeroy Jenkins',
    'email' => '[email protected]'
));

The possibility to  create various additional fields and set any other parameters is crucial in our project, so I use it in the full blast. Thus, I can send to Bugsnag all the necessary error details which are essential for further work with an exception.

So, to put the finishing touch, it’s worth saying that Bugsnag helps us to diagnose errors and react to them immediately. It provides us with the possibility to make major system decisions in the shortest time. Hope, that my experience in using Bugsnag will be useful and helps you in your work.

In case you are a B2B SaaS provider who works with the eCommerce industry, then integration with shopping platforms and marketplaces is vital for your business. Easily integrate with 40+ eCommerce platforms via one unified API provided by API2Cart.

Contact us in case you have any questions or schedule a call with our representative.

Related Articles


What is osCommerce Integration and How to Develop It in 2024?
CS-Cart Integration Development in 2024
You Asked, We Heard: 4 Amazing February 2018 Product Updates