I’m trying to port something I’ve done in Perl to Ruby and am getting
myself confused, or perhaps drowned in details between the various
I’m trying to write a custom error handler class.
The documentation tells me that you can extend the Error class with a
custom one that does more.
So I started with
class CustomError < StandardError
def initialise(arg1, arg2, arg3, *args)
def handle( opt1, opt2, opt3)
I then had a wrapper that wrapped around the code that did the work.
def dothefanango(context, &codeblock)
oops = CustomError.new( context, stuff, more_stuff)
rescue CustomError …
rescue CustomError other than the one above
rescue StandardError …
In principle, all well and good. In practice the details are killing
The pickaxe book says that the rescue clause can have parameters, but
I’m also concerned with the ‘raise’ passing back information - more than
just a string.
I’m drowning in the details and don’t know what to try and experiment
with. Any advice would be appreciated.