Exception: Exceptions::Simple

Inherits:
Base
  • Object
show all
Defined in:
lib/exceptions/simple.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#object, #type

Instance Method Summary collapse

Methods inherited from Base

build, #initialize, #model?, #simple?

Constructor Details

This class inherits a constructor from Exceptions::Base

Instance Attribute Details

#statusObject

return the error status



26
27
28
# File 'lib/exceptions/simple.rb', line 26

def status
  @status
end

Instance Method Details

#errorString

for standard errors this method build a hash

Returns:

  • (String)

    json string



9
10
11
12
13
14
15
16
17
# File 'lib/exceptions/simple.rb', line 9

def error
  { 
    error: { 
      message: self.object[:message],
      full_message: "#{self.object[:field]} #{self.object[:message]} ",
      field: self.object[:field]
    } 
  }
end

#messageString

return the error message

Returns:

  • (String)


21
22
23
# File 'lib/exceptions/simple.rb', line 21

def message
  self.object[:message]
end