Exception: Mailjet::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- Mailjet::ApiError
- Defined in:
- lib/mailjet/exception/errors.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
-
#initialize(code, body, request, url, params) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(code, body, request, url, params) ⇒ ApiError
Returns a new instance of ApiError.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mailjet/exception/errors.rb', line 22 def initialize(code, body, request, url, params) @code = code @reason = begin resdec = JSON.parse(body) resdec['ErrorMessage'] rescue JSON::ParserError body end if request.respond_to?(:options) request.[:user] = '***' request.[:password] = '***' end = "error #{code} while sending #{request.inspect} to #{url} with #{params.inspect}" error_details = body.inspect hint = "Please see https://dev.mailjet.com/email/reference/overview/errors/ for more informations on error numbers." super("#{message}\n\n#{error_details}\n\n#{hint}\n\n") end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
15 16 17 |
# File 'lib/mailjet/exception/errors.rb', line 15 def code @code end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
15 16 17 |
# File 'lib/mailjet/exception/errors.rb', line 15 def reason @reason end |