Exception: JetEmail::Error

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

Defined Under Namespace

Classes: RateLimitError

Constant Summary collapse

ClientError =
Class.new(self)
ServerError =
Class.new(self)
InternalServerError =
Class.new(ServerError)
InvalidRequestError =
Class.new(ClientError)
NotFoundError =
Class.new(ClientError)
ERRORS =
{
  400 => InvalidRequestError,
  401 => InvalidRequestError,
  403 => InvalidRequestError,
  404 => NotFoundError,
  422 => InvalidRequestError,
  429 => RateLimitError,
  500 => InternalServerError
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Error.



33
34
35
36
37
# File 'lib/jetemail/errors.rb', line 33

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

Instance Attribute Details

#headers ⇒ Object (readonly)

Returns the value of attribute headers.



31
32
33
# File 'lib/jetemail/errors.rb', line 31

def headers
  @headers
end

#status_code ⇒ Object (readonly)

Returns the value of attribute status_code.



31
32
33
# File 'lib/jetemail/errors.rb', line 31

def status_code
  @status_code
end