class Apia::ErrorExceptionError

This is the error exception that must be raised when you wish to raise an error. It should be initialized with the Apia::Error class that you wish to raise.

Attributes

error_class[R]
fields[R]

Public Class Methods

new(error_class, fields = {}) click to toggle source
# File lib/apia/errors/error_exception_error.rb, line 14
def initialize(error_class, fields = {})
  @error_class = error_class
  @fields = fields
end

Public Instance Methods

hash() click to toggle source
# File lib/apia/errors/error_exception_error.rb, line 23
def hash
  {
    code: @error_class.definition.code,
    description: @error_class.definition.description,
    detail: @error_class.definition.fields.generate_hash(@fields)
  }
end
http_status() click to toggle source
# File lib/apia/errors/error_exception_error.rb, line 19
def http_status
  @error_class.definition.http_status || 500
end