[Rails] Re: inheriting from StandardError

2012-09-17 Thread John Merlino
So we must build an entire class just for sake of more specific rescue statements: class MyError StandardError end try_counter = 0 begin try_counter += 1 puts 'Here 1' raise MyError.new Text unless try_counter 5 puts 'Here 2' rescue MyError puts 'Here 3 - MyError encountered' retry

[Rails] Re: inheriting from StandardError

2012-09-16 Thread John Merlino
I would understand if there was some level of customization involved that distinguishes it from the super class: class DoubleRenderError Error DEFAULT_MESSAGE = Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at

[Rails] Re: inheriting from StandardError

2012-09-16 Thread Frederick Cheung
On Sunday, September 16, 2012 7:57:44 PM UTC+1, John Merlino wrote: class ActionNotFound StandardError #:nodoc: end unless action_name = method_for_action(action_name) raise ActionNotFound, The action '#{action}' could not be found for #{self.class.name} end But why even