class SocialPlus::WebApi::ApiError
An Exception class which wraps errors from SocialPlus
Web API
Constants
- EXCEPTION_CLASSES
Attributes
code[R]
@return [Integer] the error code (API error code or HTTP status)
Public Class Methods
exception_from_api_result(response, result)
click to toggle source
# File lib/social_plus/web_api/api_error.rb, line 30 def self.exception_from_api_result(response, result) if social_plus_error?(response, result) error = result['error'] raise EXCEPTION_CLASSES[error['code']], error else raise HttpResponseError, response end end
new(error)
click to toggle source
@overload initialize(error)
@param error [Hash] a Hash which represents an API error @option error [String] message the error message @option error [Integer] code the error code
Calls superclass method
# File lib/social_plus/web_api/api_error.rb, line 13 def initialize(error) super(error['message']) @code = error['code'] end