Exception: Lokalise::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Lokalise::Error
- Defined in:
- lib/ruby-lokalise-api/error.rb
Constant Summary collapse
- ClientError =
Class.new(self)
- ServerError =
Class.new(self)
- BadRequest =
Class.new(ClientError)
Class.new(ClientError)
- NotAcceptable =
Class.new(ClientError)
- NotFound =
Class.new(ClientError)
- Conflict =
Class.new(ClientError)
- TooManyRequests =
Class.new(ClientError)
- Forbidden =
Class.new(ClientError)
- Locked =
Class.new(ClientError)
- MethodNowAllowed =
Class.new(ClientError)
- NotImplemented =
Class.new(ServerError)
- BadGateway =
Class.new(ServerError)
Class.new(ServerError)
- GatewayTimeout =
Class.new(ServerError)
- ERRORS =
{ 400 => Lokalise::Error::BadRequest, 401 => Lokalise::Error::Unauthorized, 403 => Lokalise::Error::Forbidden, 404 => Lokalise::Error::NotFound, 405 => Lokalise::Error::MethodNowAllowed, 406 => Lokalise::Error::NotAcceptable, 409 => Lokalise::Error::Conflict, 423 => Lokalise::Error::Locked, 429 => Lokalise::Error::TooManyRequests, 500 => Lokalise::Error::ServerError, 502 => Lokalise::Error::BadGateway, 503 => Lokalise::Error::ServiceUnavailable, 504 => Lokalise::Error::GatewayTimeout }.freeze
Class Method Summary collapse
-
.from_response(body) ⇒ Object
Create a new error from an HTTP response.
Instance Method Summary collapse
-
#initialize(message = '') ⇒ Error
constructor
Initializes a new Error object.
Constructor Details
#initialize(message = '') ⇒ Error
Initializes a new Error object
47 48 49 |
# File 'lib/ruby-lokalise-api/error.rb', line 47 def initialize( = '') super() end |
Class Method Details
.from_response(body) ⇒ Object
Create a new error from an HTTP response
41 42 43 |
# File 'lib/ruby-lokalise-api/error.rb', line 41 def from_response(body) new body['error']['message'].to_s end |