Sha256: 332712219c2a72f6a1ab7f06addca7eed50083eb93ae7f13849392bb8a90336d

Contents?: true

Size: 504 Bytes

Versions: 7

Compression:

Stored size: 504 Bytes

Contents

module SendGridMailer
  class Error < RuntimeError
  end

  class InvalidApiKey < Error
    def initialize
      super("The SendGrid API key is invalid or missing")
    end
  end

  class ApiError < Error
    attr_reader :error_code, :errors

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
send_grid_mailer-2.3.0 lib/send_grid_mailer/errors.rb
send_grid_mailer-2.2.0 lib/send_grid_mailer/errors.rb
send_grid_mailer-2.0.1 lib/send_grid_mailer/errors.rb
send_grid_mailer-2.0.0 lib/send_grid_mailer/errors.rb
send_grid_mailer-1.2.1 lib/send_grid_mailer/errors.rb
send_grid_mailer-1.2.0 lib/send_grid_mailer/errors.rb
send_grid_mailer-1.1.0 lib/send_grid_mailer/errors.rb