Exception: Mango::Error

Inherits:
StandardError
  • Object
show all
Includes:
Enumerable
Defined in:
lib/mango.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, errors = {}) ⇒ Error

Returns a new instance of Error.



11
12
13
14
# File 'lib/mango.rb', line 11

def initialize message, errors={}
  super message
  @errors = errors
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



9
10
11
# File 'lib/mango.rb', line 9

def errors
  @errors
end

Instance Method Details

#eachObject

Yield [error_code, message] pairs



17
18
19
# File 'lib/mango.rb', line 17

def each
  @errors.each { |e| yield *e.first }
end