class Notion::Faraday::Response::RaiseError
Public Instance Methods
call(env)
click to toggle source
Calls superclass method
# File lib/notion/faraday/response/raise_error.rb, line 23 def call(env) super rescue ::Faraday::ParsingError raise Notion::Api::Errors::ParsingError.new('parsing_error', env.response) end
on_complete(env)
click to toggle source
# File lib/notion/faraday/response/raise_error.rb, line 6 def on_complete(env) raise Notion::Api::Errors::TooManyRequests, env.response if env.status == 429 return if env.success? body = env.body return unless body error_code = body['code'] error_message = body['message'] error_details = body['details'] error_class = Notion::Api::Errors::ERROR_CLASSES[error_code] error_class ||= Notion::Api::Errors::NotionError raise error_class.new(error_message, error_details, env.response) end