mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-04-27 14:57:44 +00:00
improve error handling on generic errors
This commit is contained in:
parent
1c9a381fff
commit
4c9319b67c
1 changed files with 9 additions and 5 deletions
|
|
@ -53,11 +53,15 @@ module Instapaper
|
||||||
# @param response [HTTP::Response]
|
# @param response [HTTP::Response]
|
||||||
# @return [Instapaper::Error]
|
# @return [Instapaper::Error]
|
||||||
def self.from_response(code, path)
|
def self.from_response(code, path)
|
||||||
case path
|
if ERRORS.keys.include?(code)
|
||||||
when /highlights/ then HighlightError.new(HIGHLIGHT_ERRORS[code], code)
|
new(ERRORS[code], code)
|
||||||
when /bookmarks/ then BookmarkError.new(BOOKMARK_ERRORS[code], code)
|
else
|
||||||
when /folders/ then FolderError.new(FOLDER_ERRORS[code], code)
|
case path
|
||||||
else new(ERRORS[code], code)
|
when /highlights/ then HighlightError.new(HIGHLIGHT_ERRORS[code], code)
|
||||||
|
when /bookmarks/ then BookmarkError.new(BOOKMARK_ERRORS[code], code)
|
||||||
|
when /folders/ then FolderError.new(FOLDER_ERRORS[code], code)
|
||||||
|
else new('Unknown Error Code', code)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue