jmettraux/ruote — pull request #92 by denisahearn (2014-01-22 21:32:30+00:00)
Title: Fixed issue in ProcessObserver when handling error_intercepted message, ...

...and exception class constructor is non-standard.

This is a fix for an issue we experienced when using the ProcessObserver to listen for the "error_intercepted" message. If the exception that caused this message has an initialize method that expects arguments other than a single "message" argument, the ProcessObsever#route method would crash when attempting to reconstruct the error object. The ActiveModel::MassAssignmentSecurity::Error class in Rails is one such exception class. Its initialize method excepts two arguments which it uses to produce the error message. My solution is to put a begin..rescue around the code that is instantiating the error object. If that fails, then an instance of Ruote::ProcessObserver::Error is created instead (a new class I defined). This new exception class keeps track of the original exception class in case any downstream code needs to know the type of the exception that was originally raised.

Please consider accepting my fix into Ruote. Please feel free to contact me if you see a better way to solve this problem, and would like to discuss it with me.

Thanks,
Denis