Exception: Obscured::Doorman::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/obscured-doorman/errors.rb

Constant Summary collapse

ERRORS =
{
  invalid_api_method: 'No method parameter was supplied',
  unspecified_error: 'Unspecified error',
  already_exists: '{what}',
  does_not_exist: '{what}',
  does_not_match: '{what}',
  account: '{what}',
  invalid_date: 'Cannot parse {what} from: {date}',
  invalid_type: '{what}',
  not_active: 'Not active',
  required_field_missing: 'Required field {field} is missing'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, params = {}) ⇒ Error

Returns a new instance of Error.



23
24
25
26
27
28
29
30
31
# File 'lib/obscured-doorman/errors.rb', line 23

def initialize(code, params = {})
  field = params.delete(:field)
  error = params.delete(:error)

  super(parse(code, params))
  @code = code || :unspecified_error
  @field = field || :unspecified_field
  @error = error
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/obscured-doorman/errors.rb', line 6

def code
  @code
end

#errorObject (readonly)

Returns the value of attribute error.



8
9
10
# File 'lib/obscured-doorman/errors.rb', line 8

def error
  @error
end

#fieldObject (readonly)

Returns the value of attribute field.



7
8
9
# File 'lib/obscured-doorman/errors.rb', line 7

def field
  @field
end