class Remap::Failure
Public Instance Methods
exception(backtrace)
click to toggle source
@param backtrace [Array<String>] Backtrace from Kernel.caller
@return [Failure::Error]
# File lib/remap/failure.rb, line 33 def exception(backtrace) e = Error.new(failure: self) e.set_backtrace(backtrace) e end
merge(other)
click to toggle source
Merges two failures and returns a new failure
@param other [Failure]
@return [Failure]
# File lib/remap/failure.rb, line 13 def merge(other) unless other.is_a?(self.class) raise ArgumentError, "Cannot merge %s (%s) with %s (%s)" % [ self, self.class, other, other.class ] end failure = attributes.merge(other.attributes) do |key, value1, value2| case [key, value1, value2] in [:failures | :notices, Array, Array] value1 + value2 end end new(failure) end