Exception: EmailFuse::Error

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

Overview

Errors wrapper class

Defined Under Namespace

Classes: RateLimitExceededError

Constant Summary collapse

ClientError =

4xx HTTP status code

Class.new(self)
ServerError =

5xx HTTP status code

Class.new(self)
InternalServerError =

code 500

Class.new(ServerError)
InvalidRequestError =

code 400, 401, 404, 422 - these are client errors (4xx)

Class.new(ClientError)
NotFoundError =

code 404

Class.new(ClientError)
ERRORS =
{
  400 => EmailFuse::Error::InvalidRequestError,
  401 => EmailFuse::Error::InvalidRequestError,
  404 => EmailFuse::Error::NotFoundError,
  422 => EmailFuse::Error::InvalidRequestError,
  429 => EmailFuse::Error::RateLimitExceededError,
  500 => EmailFuse::Error::InternalServerError
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, code = nil, headers = {}) ⇒ Error

Returns a new instance of Error.



45
46
47
48
49
# File 'lib/email_fuse/errors.rb', line 45

def initialize(msg, code = nil, headers = {})
  super(msg)
  @code = code
  @headers = headers
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



43
44
45
# File 'lib/email_fuse/errors.rb', line 43

def code
  @code
end

#headersObject (readonly)

Returns the value of attribute headers.



43
44
45
# File 'lib/email_fuse/errors.rb', line 43

def headers
  @headers
end