class ChatWork::ChatWorkError
Attributes
error_response[R]
status[R]
Public Class Methods
from_response(status, body, headers)
click to toggle source
# File lib/chatwork/chatwork_error.rb, line 3 def self.from_response(status, body, headers) body ||= {} if headers.has_key?("WWW-Authenticate") return AuthenticateError.from_www_authenticate( www_authenticate: headers["WWW-Authenticate"], status: status, error_response: body["errors"], ) end return APIError.new(status, body["errors"]) if body["errors"] if body["error"] message = [body["error"], body["error_description"]].compact.join(" ") return AuthenticateError.new(message, status, body, body["error"], body["error_description"]) end APIConnectionError.new("Invalid response #{body.to_hash} (status: #{status})") end
new(message, status = nil, error_response = nil)
click to toggle source
Calls superclass method
# File lib/chatwork/chatwork_error.rb, line 27 def initialize(message, status = nil, error_response = nil) @status = status @error_response = error_response super(message) end