Exception: Poodle::AuthenticationError
- Defined in:
- lib/poodle/errors/authentication_error.rb
Overview
Exception raised when API authentication fails (401 Unauthorized)
Instance Attribute Summary
Attributes inherited from Error
Class Method Summary collapse
-
.expired_api_key ⇒ AuthenticationError
Create an AuthenticationError for expired API key.
-
.invalid_api_key ⇒ AuthenticationError
Create an AuthenticationError for invalid API key.
-
.missing_api_key ⇒ AuthenticationError
Create an AuthenticationError for missing API key.
Instance Method Summary collapse
-
#initialize(message = "Authentication failed", context: {}) ⇒ AuthenticationError
constructor
Initialize a new AuthenticationError.
Methods inherited from Error
Constructor Details
#initialize(message = "Authentication failed", context: {}) ⇒ AuthenticationError
Initialize a new AuthenticationError
20 21 22 |
# File 'lib/poodle/errors/authentication_error.rb', line 20 def initialize( = "Authentication failed", context: {}) super(, context: context, status_code: 401) end |
Class Method Details
.expired_api_key ⇒ AuthenticationError
Create an AuthenticationError for expired API key
47 48 49 50 51 52 |
# File 'lib/poodle/errors/authentication_error.rb', line 47 def self.expired_api_key new( "API key has expired. Please generate a new API key.", context: { error_type: "expired_api_key" } ) end |
.invalid_api_key ⇒ AuthenticationError
Create an AuthenticationError for invalid API key
27 28 29 30 31 32 |
# File 'lib/poodle/errors/authentication_error.rb', line 27 def self.invalid_api_key new( "Invalid API key provided. Please check your API key and try again.", context: { error_type: "invalid_api_key" } ) end |
.missing_api_key ⇒ AuthenticationError
Create an AuthenticationError for missing API key
37 38 39 40 41 42 |
# File 'lib/poodle/errors/authentication_error.rb', line 37 def self.missing_api_key new( "API key is required. Please provide a valid API key.", context: { error_type: "missing_api_key" } ) end |