Exception: Resend::Error

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

Overview

Errors wrapper class For more info: resend.com/docs/api-reference/error-codes

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 422

Class.new(ServerError)
RateLimitExceededError =

code 429

Class.new(ServerError)
NotFoundError =

code 404

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

Instance Method Summary collapse

Constructor Details

#initialize(msg, code = nil) ⇒ Error

Returns a new instance of Error.



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

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