← Blog Home

ruby Blog Posts

Ruby Exception Handling - Primer for Dealing with Errors in Ruby

Written By Rivkah Standig December 19th, 2016

Ruby is a popular open source programming language that is highly flexible, and used for everything from basic "hello world" apps to sophisticated, dynamic programs. Whether you've been programming in Ruby for years or you're a complete beginner, tracking down errors in your Ruby app is simple and easy. Let's go through some basic Ruby error handling, and discover how easy it can be to integrate Rollbar into your Ruby app to automatically log and report your exceptions.

Raise and Rescue Exceptions

Ruby's default exception handling is to terminate the program in the event of an exception. That's not really useful when you're trying to build a complex web application for multiple users. Luckily there's a way around this - declaring exception handlers. Exception handlers are blocks of code that are called if an exception occurs in the execution of another block of code in your program. For the most basic Ruby exception handling, you need to know how to Raise and Rescue an exception.

When you Raise an exception, you stop the normal flow of the program, and execute the code that deals with handling an error. This code can either deal with the error in some way, or terminate the program. If you provide a Rescue clause in your error handler, you can choose how to deal with the exception; without it, the program will simply terminate.

Read more

Improved ruby error reporting with our latest gem updates

Written By Jon de Andres September 14th, 2016

Recently, we released version 2.13.0 of the rollbar-gem. This update is full of new features and some minor bug fixes. The full release notes can be found here, Release 2.13.0. Here are a few of the highlights in this update:

1. Allow overriding configuration

Many customers have asked to implement a way to override the default configuration for a specific block of code. Some of them use the same process to send reports to our API for different projects, some need to change the environment, and others want to use one async handler for a single block of code (or none at all).

So, we've added a new method called Rollbar.with_config to do this. It receives a Hash object with the configuration overrides you want to use for the given block. The configuration options can be found at Configuration. The Hash passed to with_config should be formatted like {environment: 'specific-environment'}. For example:

Read more

rollbar-gem v0.12.20 released

Written By Brian Rue May 29th, 2014
We've released a new patch version of rollbar-gem, version 0.12.20. Get it on Rubygems or GitHub.
Read more

Join Our Community

Get the latest updates, tutorials and more, delivered to your inbox, once a month.

Join Our Community

Get the latest updates, tutorials and more, delivered to your inbox, once a month.