How to raise any object as a Ruby exception

It's a common misconception that the raise method only accepts exceptions as its argument. This post will show you how you can raise ANYTHING, including numbers, dates, and your own custom classes.


How Rails' fancy exception page works

One of the nice things about working with rails is that when something goes wrong in development, you get a really nice error detail page. Today we're going to take a look at how these fancy error pages work.


How to clear all Sidekiq queues, using the power of emoji

It’s easy to find code snippets that will delete the jobs from one Sidekiq queue. But we have *lots* of queues. I want to clear the jobs from all of them. After a little digging, I came up with an answer that seems to work well.



How to add context data to exceptions in Ruby

Sometimes the standard backtrace / error message combo isn't enough. Sometimes you need extra data to locate the cause of an error. In this post we'll discuss three easy ways to add more context to your exceptions.


Understanding Ruby's strange "Errno" exceptions

If you've ever taken a look at Ruby's exception hierarchy, you may have noticed something weird. In addition to all of the normal exceptions like RuntimeError and NoMethodError, there's an odd reference to Errno::* . This post discusses what these exceptions are and how to interpret them.


A theoretical introduction to unix daemons in Ruby

Unix daemons are programs that run in the background. Nginx, Postgres and OpenSSH are a few examples. They use a some special tricks to “detatch” their processes, and let them run independently of any terminal. I thought it’d be fun to do a post illustrating how they work in Ruby.


Logging local & instance variables when exceptions occur in Ruby

With hard-to-reproduce bugs, it can be really handy to log all of the local and instance variables along with the exception. This post shows you how. Along the way we'll introduce Ruby's binding system as well as the binding_of_caller gem - a powerful tool for introspection.


Go write a web app! Five interesting Go web frameworks

Go is such a new language that even more established frameworks can have interesting quirks. One of the key issues learning the Go framework is the availability of useful documentation. Unfortunately, Go framework maintainers don’t always prioritize writing the documentation necessary to get new programmers up to speed on their frameworks. The five frameworks below, however, have usable documentation and are straightforward to use.


Remote Debugging with Byebug, Rails and Pow

Byebug is a simple to use, feature rich debugger for Ruby 2.x. In this post, we'll discuss how to set up remote debugging with byebug so that you can debug code running in Pow, Unicorn or other application servers.


Ruby's case statement - advanced techniques

Nothing could be simpler and more boring than the case statement. It’s a holdover from C. You use it to replace a bunch of ifs. Case closed. Or is it? Actually, case statements in Ruby are a lot richer and more complex than you might imagine. Let’s take a look.



Level-up `rescue` with dynamic exception matchers

When you use a rescue clause in Ruby, you can specify what kinds of exceptions you want to rescue. But what if you want to rescue exceptions by severity? By message? By time of day? In this post we'll discuss how you can create dynamic exception matchers that use your logic to decide if an exception gets rescued.


Nested errors in Ruby with Exception#cause

It's a common pattern in Ruby to rescue and exception and re-raise another kind of exception. But the original exception isn't lost! You can use Exception#cause to grab it. In this post we show you how.


Announcing realtime error monitoring for Go

If you're a Go developer, we have some great news: you can now monitor your Go applications for panics and errors with Honeybadger! We've been working hard to create the same great error monitoring experience that our Ruby customers enjoy for the Go community, and we hope you'll love the results.


How to "try again" when exceptions happen in Ruby

Ruby provides a few interesting mechanisms that make it easy to "try again" - though not all of them are obvious or well-known. In this post we'll take a look at these mechanisms and how they work.




The clever hack that makes `items.map(&:name)` work

The &: trick is a great shortcut when using enumerable methods like map. The way it works may surprise you. In this post we'll look in detail at exactly how code like `users.map(&:name)` functions under the hood.