class Bumbleworks::Process::ErrorRecord
Attributes
Public Class Methods
The initializer takes a Ruote::ProcessError instance.
# File lib/bumbleworks/process/error_record.rb, line 10 def initialize(process_error) @process_error = process_error end
Public Instance Methods
Returns the original error's backtrace.
The original backtrace will be returned in standard backtrace format: an array of strings with paths and line numbers.
# File lib/bumbleworks/process/error_record.rb, line 45 def backtrace @process_error.h['trace'].split(/\n/) end
Be aware that this class may not exist in the current binding when you instantiate the ErrorRecord
; if it does not, calling reify
will throw an exception.
# File lib/bumbleworks/process/error_record.rb, line 37 def error_class_name @process_error.h['class'] end
Returns the expression where this error occurred.
# File lib/bumbleworks/process/error_record.rb, line 22 def expression Bumbleworks::Expression.from_fei(fei) end
Returns the original error message.
Ruote's error logging has a strange issue; the message recorded and returned via the Ruote::ProcessError instance is the full inspect of the error. This method strips away the resulting cruft (if it exists) and leaves behind just the message itself.
# File lib/bumbleworks/process/error_record.rb, line 55 def message @message ||= @process_error.message. gsub(/\#\<#{error_class_name}: (.*)\>$/, '\1') end
Returns the process in which this error occurred.
# File lib/bumbleworks/process/error_record.rb, line 27 def process Bumbleworks::Process.new(wfid) end
Re-instantiates the original exception.
If you wish to re-create the actual exception that was raised during process execution, this method will attempt to return an instance of the error class, with the message and backtrace restored.
In order for this to work, the error class itself must be a defined constant in the current binding; if it's not, you'll get an exception. Be cognizant of this caveat if you choose to use this feature; Bumbleworks
makes no attempt to protect you.
This is not because Bumbleworks
doesn't love you. It just wants you to spread your wings, and the only way to truly experience flight is to first taste the ground.
# File lib/bumbleworks/process/error_record.rb, line 75 def reify klass = Bumbleworks::Support.constantize(error_class_name) err = klass.new(message) err.set_backtrace(backtrace) err end
Replays the error's process at the point where the error occurred. Should only be called when the cause of the error has been fixed, since otherwise this will just cause the error to show up again.
# File lib/bumbleworks/process/error_record.rb, line 17 def replay Bumbleworks.dashboard.replay_at_error(@process_error) end