Exception: StashCoreAPI::Error
- Inherits:
-
StandardError
- Object
- StandardError
- StashCoreAPI::Error
- Defined in:
- lib/stash_core_api/error.rb
Overview
Base class for all errors emanating from Stash.
Constant Summary collapse
- ClientError =
Raised when Stash returns a 4xx HTTP status code
Class.new(self)
- BadRequest =
Raised when Stash returns the HTTP status code 400
Class.new(ClientError)
Class.new(ClientError)
- Forbidden =
Raised when Stash returns the HTTP status code 403
Class.new(ClientError)
- NotFound =
Raised when Stash returns the HTTP status code 404
Class.new(ClientError)
- MethodNotAllowed =
Raised when Stash returns the HTTP status code 405
Class.new(ClientError)
- Conflict =
Raised when Stash returns the HTTP status code 409
Class.new(ClientError)
- UnsupportedMediaType =
Raised when Stash returns the HTTP status code 415
Class.new(ClientError)
- ERRORS =
{ 400 => StashCoreAPI::Error::BadRequest, 401 => StashCoreAPI::Error::Unauthorized, 403 => StashCoreAPI::Error::Forbidden, 404 => StashCoreAPI::Error::NotFound, 405 => StashCoreAPI::Error::MethodNotAllowed, 409 => StashCoreAPI::Error::Conflict, 415 => StashCoreAPI::Error::UnsupportedMediaType, }.freeze
Instance Method Summary collapse
-
#initialize(body = {}) ⇒ StashCoreAPI::Error
constructor
Initializes a new Error object.
Constructor Details
#initialize(body = {}) ⇒ StashCoreAPI::Error
Initializes a new Error object
45 46 47 48 |
# File 'lib/stash_core_api/error.rb', line 45 def initialize(body = {}) = body.fetch('errors', {}).fetch(0, {}).fetch('message', '') super() end |