Class: Faraday::Response::RaiseNotionRubyError Private

Inherits:
Response::Middleware
  • Object
show all
Defined in:
lib/notion_ruby/errors.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

ERROR_MAP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  400 => NotionRuby::BadRequest,
  401 => NotionRuby::Unauthorized,
  403 => NotionRuby::Forbidden,
  406 => NotionRuby::NotAcceptable,
  422 => NotionRuby::UnprocessableEntity,
  500 => NotionRuby::InternalServerError,
  501 => NotionRuby::NotImplemented,
  502 => NotionRuby::BadGateway,
  503 => NotionRuby::ServiceUnavailable
}.freeze

Instance Method Summary collapse

Instance Method Details

#on_complete(response) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:



90
91
92
93
# File 'lib/notion_ruby/errors.rb', line 90

def on_complete(response)
  key = response[:status].to_i
  raise ERROR_MAP[key], response if ERROR_MAP.key? key
end