Exception: NotionRuby::Error

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

Overview

Custom error class for rescuing from all Notion errors

Instance Method Summary collapse

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(build_error_message)
end

Instance Method Details

#response_bodyObject



14
15
16
# File 'lib/notion_ruby/errors.rb', line 14

def response_body
  @response_body ||= (body = @response[:body]) && !body.empty? ? body : nil
end