class Oni::WrappedError

Error class that can be used to wrap existing errors and attach extra data to them. This class is primarily intended to be used within workers to attach the input to the error.

@!attribute [r] original_error

@return [StandardError]

@!attribute [r] parameters

@return [Mixed]

Attributes

original_error[R]
parameters[R]

Public Class Methods

from(error, parameters = nil) click to toggle source

Wraps an existing error.

@param [StandardError] error @param [Mixed] parameters @return [Oni::WrappedError]

# File lib/oni/wrapped_error.rb, line 23
def self.from(error, parameters = nil)
  return new(
    error.message,
    :original_error => error,
    :parameters     => parameters
  )
end
new(message = nil, options = {}) click to toggle source

@param [String] message @param [Hash] options

Calls superclass method
# File lib/oni/wrapped_error.rb, line 35
def initialize(message = nil, options = {})
  super(message)

  options.each do |key, value|
    instance_variable_set("@#{key}", value) if respond_to?(key)
  end
end