Exception: Starwars::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Starwars::Error
- Defined in:
- lib/starwars/error.rb
Overview
Custom error class for rescuing from all Starwars errors
Direct Known Subclasses
Defined Under Namespace
Classes: ArgumentError, BadRequest, ClientError, Forbidden, InternalServerError, NotFound, RequestTimeout, ServerError, ServiceUnavailableError, Unauthorized
Class Method Summary collapse
-
.errors ⇒ Hash
Return a hash of error classes.
Instance Method Summary collapse
-
#initialize(message = '', _status = nil) ⇒ Starwars::Error
constructor
Initializes a new Error object.
Constructor Details
#initialize(message = '', _status = nil) ⇒ Starwars::Error
Initializes a new Error object
30 31 32 |
# File 'lib/starwars/error.rb', line 30 def initialize( = '', _status = nil) super() end |
Class Method Details
.errors ⇒ Hash
Return a hash of error classes
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/starwars/error.rb', line 10 def errors @errors ||= { 400 => Starwars::Error::BadRequest, 401 => Starwars::Error::Unauthorized, 403 => Starwars::Error::Forbidden, 404 => Starwars::Error::NotFound, 500 => Starwars::Error::InternalServerError, 503 => Starwars::Error::ServiceUnavailableError } end |