19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/notion-sdk-ruby/error.rb', line 19
def self.create(error = {})
return NotionError.new("Unknown error.") if error["message"].nil?
if API_ERROR_CODE.value?(error["code"])
APIResponseError.new(error["message"], body: error)
elsif error["request"] && error["response"] && error["timings"]
HTTPResponseError.new(error["message"], body: error)
elsif error["request"] && error["timings"]
RequestTimeoutError.new(error["message"], body: error)
else
NotionError.new(error["message"])
end
end
|