Exception: SendGridMailer::ApiError

Inherits:
Error
  • Object
show all
Defined in:
lib/send_grid_mailer/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_code, errors) ⇒ ApiError

Returns a new instance of ApiError.



14
15
16
17
18
19
# File 'lib/send_grid_mailer/errors.rb', line 14

def initialize(error_code, errors)
  @error_code = error_code
  @errors = errors
  error_message = errors.map { |err| err['message'] }.join('. ')
  super("Sendgrid API error. Code: #{error_code}. Errors: #{error_message}")
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



12
13
14
# File 'lib/send_grid_mailer/errors.rb', line 12

def error_code
  @error_code
end

#errorsObject (readonly)

Returns the value of attribute errors.



12
13
14
# File 'lib/send_grid_mailer/errors.rb', line 12

def errors
  @errors
end