Exception: NotionRuby::Error
- Inherits:
-
StandardError
- Object
- StandardError
- NotionRuby::Error
- Defined in:
- lib/notion_ruby/errors.rb
Overview
Custom error class for rescuing from all Notion errors
Direct Known Subclasses
BadGateway, BadRequest, Forbidden, InternalServerError, NotAcceptable, NotFound, NotImplemented, ServiceUnavailable, Unauthorized, UnprocessableEntity
Instance Method Summary collapse
-
#initialize(response = nil) ⇒ Error
constructor
A new instance of Error.
- #response_body ⇒ Object
Constructor Details
#initialize(response = nil) ⇒ Error
Returns a new instance of Error.
9 10 11 12 |
# File 'lib/notion_ruby/errors.rb', line 9 def initialize(response = nil) @response = response super() end |
Instance Method Details
#response_body ⇒ Object
14 15 16 |
# File 'lib/notion_ruby/errors.rb', line 14 def response_body @response_body ||= (body = @response[:body]) && !body.empty? ? body : nil end |