class Odnoklassniki::Error
Custom error class for rescuing from all Odnoklassniki
errors
Constants
- BadGateway
Raised when
Odnoklassniki
returns the HTTP status code 502- BadRequest
Raised when
Odnoklassniki
returns the HTTP status code 400- ClientError
Raised when
Odnoklassniki
returns a 2xx HTTP status code- ERRORS
- Forbidden
Raised when
Odnoklassniki
returns the HTTP status code 403- GatewayTimeout
Raised when
Odnoklassniki
returns the HTTP status code 504- InternalServerError
Raised when
Odnoklassniki
returns the HTTP status code 500- NotAcceptable
Raised when
Odnoklassniki
returns the HTTP status code 406- NotFound
Raised when
Odnoklassniki
returns the HTTP status code 404- ServerError
Raised when
Odnoklassniki
returns a 5xx HTTP status codeRaised when
Odnoklassniki
returns the HTTP status code 503- TooManyRequests
Raised when
Odnoklassniki
returns the HTTP status code 429Raised when
Odnoklassniki
returns the HTTP status code 401- UnprocessableEntity
Raised when
Odnoklassniki
returns the HTTP status code 422
Attributes
@return [Integer]
Public Class Methods
Create a new error from an HTTP response
@param response [HTTP::Response] @return [Odnoklassniki::Error]
# File lib/odnoklassniki/error.rb, line 160 def from_response(body) new(*parse_error(body)) end
Initializes a new Error
object
@param message [Exception, String] @param code [Integer] @return [Odnoklassniki::Error]
# File lib/odnoklassniki/error.rb, line 177 def initialize(message = '', code = nil) super(message) @code = code end
Private Class Methods
# File lib/odnoklassniki/error.rb, line 166 def parse_error(body) [body['error_msg'].to_s, body['error_code']] end