If you want insights into your application's exceptions but don't have time to invest in adding verbose logic to your code, we've got some exceptional news: The AppSignal for Ruby gem 3.4.1 now supports the Rails error reporter!
With this change, you can simplify your AppSignal integration, streamline your code and begin reporting errors on the fly without raising an error page and interrupting your user's flow.
In this blog post, we'll show you how you can start reporting errors to AppSignal with the Rails Error Reporter.
Bye, Bye Begin Blocks
The Rails Error Reporter removes the need for verbose begin
blocks in your code and provides a more explicit and standardized way of reporting your application's exceptions.
Previously, when you wanted to report an exception to AppSignal without raising an error (also known as swallowing an error), you'd use a begin block:
With the Rails Error Reporter, we can now simplify this down to as few as three lines of code, and AppSignal will automatically detect the action and namespace from the parent web request or background job:
Errors raised using the Rails Error Reporter's handle
method will be reported to AppSignal as separate samples, allowing for multiple errors to be reported within the same request or job. If you use the record
method, the error will not be swallowed and will instead be re-raised. In these instances, our Rails middleware will report the error.
Contextual Error Reporting
If you want to use a custom namespace or action name for a request or job's transaction, you can use our set_namespace
and set_action
helper methods:
Alternatively, if you want to use a custom namespace and action name only when reporting a specific error, you can add them to the Rails Error Reporters context:
You can also supply custom tags to the error's context, which you will be able to use to filter through your application's incidents:
Exceptional Monitoring for Exceptional Applications
You can read more about AppSignal's error reporting in our Rails documentation, and if you experience any issues when using Rails Error Reporter, get in touch with our exceptional support team.
AppSignal's Error Reporting is just one of our many developer-driven features that help you get the most out of monitoring your application. Developers also enjoy using our monitoring because we have:
- An intuitive interface that is easy to navigate.
- Simple and predictable pricing.
- Developer-to-developer support.
Don't forget, if you're new to AppSignal, we'll welcome you onboard with an exceptionally delicious shipment of stroopwafels 🍪 😋