Exception: Oni::WrappedError
- Inherits:
-
StandardError
- Object
- StandardError
- Oni::WrappedError
- Defined in:
- lib/oni/wrapped_error.rb
Overview
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.
Instance Attribute Summary collapse
- #original_error ⇒ StandardError readonly
- #parameters ⇒ Mixed readonly
Class Method Summary collapse
-
.from(error, parameters = nil) ⇒ Oni::WrappedError
Wraps an existing error.
Instance Method Summary collapse
-
#initialize(message = nil, options = {}) ⇒ WrappedError
constructor
A new instance of WrappedError.
Constructor Details
#initialize(message = nil, options = {}) ⇒ WrappedError
Returns a new instance of WrappedError.
35 36 37 38 39 40 41 |
# File 'lib/oni/wrapped_error.rb', line 35 def initialize( = nil, = {}) super() .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end end |
Instance Attribute Details
#original_error ⇒ StandardError (readonly)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/oni/wrapped_error.rb', line 13 class WrappedError < StandardError attr_reader :original_error, :parameters ## # Wraps an existing error. # # @param [StandardError] error # @param [Mixed] parameters # @return [Oni::WrappedError] # def self.from(error, parameters = nil) return new( error., :original_error => error, :parameters => parameters ) end ## # @param [String] message # @param [Hash] options # def initialize( = nil, = {}) super() .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end end end |
#parameters ⇒ Mixed (readonly)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/oni/wrapped_error.rb', line 13 class WrappedError < StandardError attr_reader :original_error, :parameters ## # Wraps an existing error. # # @param [StandardError] error # @param [Mixed] parameters # @return [Oni::WrappedError] # def self.from(error, parameters = nil) return new( error., :original_error => error, :parameters => parameters ) end ## # @param [String] message # @param [Hash] options # def initialize( = nil, = {}) super() .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end end end |
Class Method Details
.from(error, parameters = nil) ⇒ Oni::WrappedError
Wraps an existing error.
23 24 25 26 27 28 29 |
# File 'lib/oni/wrapped_error.rb', line 23 def self.from(error, parameters = nil) return new( error., :original_error => error, :parameters => parameters ) end |