Exception: Logan::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/logan/errors.rb

Direct Known Subclasses

AccessDeniedError, InvalidRequestError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message) ⇒ Error

Returns a new instance of Error.



6
7
8
9
# File 'lib/logan/errors.rb', line 6

def initialize(code, message)
  @code = code.to_sym
  @message = message
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/logan/errors.rb', line 3

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/logan/errors.rb', line 4

def message
  @message
end

Instance Method Details

#to_jsonObject



11
12
13
# File 'lib/logan/errors.rb', line 11

def to_json
  JSON.generate({error: @code.to_s, error_description: @message})
end