Exception: Poodle::ServerError
- Defined in:
- lib/poodle/errors/server_error.rb
Overview
Exception raised when server errors occur (5xx status codes)
Instance Attribute Summary
Attributes inherited from Error
Class Method Summary collapse
-
.bad_gateway(message = "Bad gateway") ⇒ ServerError
Create a ServerError for bad gateway.
-
.gateway_timeout(message = "Gateway timeout") ⇒ ServerError
Create a ServerError for gateway timeout.
-
.internal_server_error(message = "Internal server error") ⇒ ServerError
Create a ServerError for internal server error.
-
.service_unavailable(message = "Service unavailable") ⇒ ServerError
Create a ServerError for service unavailable.
Instance Method Summary collapse
-
#initialize(message = "Server error occurred", context: {}, status_code: 500) ⇒ ServerError
constructor
Initialize a new ServerError.
Methods inherited from Error
Constructor Details
#initialize(message = "Server error occurred", context: {}, status_code: 500) ⇒ ServerError
Initialize a new ServerError
21 22 23 |
# File 'lib/poodle/errors/server_error.rb', line 21 def initialize( = "Server error occurred", context: {}, status_code: 500) super(, context: context.merge(error_type: "server_error"), status_code: status_code) end |
Class Method Details
.bad_gateway(message = "Bad gateway") ⇒ ServerError
Create a ServerError for bad gateway
37 38 39 |
# File 'lib/poodle/errors/server_error.rb', line 37 def self.bad_gateway( = "Bad gateway") new(, status_code: 502) end |
.gateway_timeout(message = "Gateway timeout") ⇒ ServerError
Create a ServerError for gateway timeout
53 54 55 |
# File 'lib/poodle/errors/server_error.rb', line 53 def self.gateway_timeout( = "Gateway timeout") new(, status_code: 504) end |
.internal_server_error(message = "Internal server error") ⇒ ServerError
Create a ServerError for internal server error
29 30 31 |
# File 'lib/poodle/errors/server_error.rb', line 29 def self.internal_server_error( = "Internal server error") new(, status_code: 500) end |
.service_unavailable(message = "Service unavailable") ⇒ ServerError
Create a ServerError for service unavailable
45 46 47 |
# File 'lib/poodle/errors/server_error.rb', line 45 def self.service_unavailable( = "Service unavailable") new(, status_code: 503) end |