Rescue any exception in Ruby

/ Published in: Bash
Save to your folder(s)

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:

Copy this code and paste it in your HTML
  1. rescue Exception => e

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.