
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:
begin
raise "Oh CRUD!"
rescue => error
Appsignal.send_error(error) do |transaction|
# Here, you manually define the action and namespace where the exception has occurred
transaction.set_action("StroopwaffleController#request_waffles")
transaction.set_namespace("web")
end
endWith 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:
Rails.error.handle do
raise "CRUD!"
endErrors 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:
Appsignal.set_namespace("custom_namespace")
Appsignal.set_action("CustomizedActionName#index")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:
Rails.error.handle(:context => { :appsignal => { :namespace => "custom_namespace", :action => "CustomizedActionName#index" } }) do
raise "Contextual CRUD!"
endYou can also supply custom tags to the error's context, which you will be able to use to filter through your application's incidents:
Rails.error.handle(:context => { :tag1 => "value1", :tag2 => "value2" }) do
raise "Tagged CRUD!"
end
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 🍪 😋
Wondering what you can do next?
- Try out AppSignal with a 30-day free trial.
- Reach out to our support team with any feedback or questions.
- Share this article on social media

Connor James
Developer Marketing Manager at AppSignal. Podcast addict who loves cannoli so much that he's considering changing his name to Connoli. He thinks there's a `u` in color. You might find him on the mic, on the stage, or lying on the sofa when he's off duty.
All articles by Connor James
Tom de Bruijn
Tom is a developer at AppSignal, organizer, and writer from Amsterdam, The Netherlands.
All articles by Tom de BruijnBecome our next author!
AppSignal monitors your apps
AppSignal provides insights for Ruby, Rails, Elixir, Phoenix, Node.js, Express and many other frameworks and libraries. We are located in beautiful Amsterdam. We love stroopwafels. If you do too, let us know. We might send you some!


