Posted By

cczona on 10/20/11


ruby exception begin ensure rescue StandardError

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Rescue any exception in Ruby

 / Published in: Bash

From the Pickaxe, 4th edition, p. 352:

A rescue clause with no parameter is treated as if it had a parameter of StandardError. This means that some lower-level exceptions will not be caught by a parameterless rescue class. If you want to rescue every exception, use this:

  1. rescue Exception => e

Report this snippet  

You need to login to post a comment.