Skip to content

Commit

Permalink
Add a typed exception for unknown server errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
woodhull committed Jan 10, 2024
1 parent 364c460 commit 19efd3c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/action_kit_rest/response/raise_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def on_complete(response)
if error_message == 'Sorry, this request could not be processed. Please try again later.'
raise ActionKitRest::Response::TryAgainLater, error_message(response)
else
raise StandardError, error_message(response)
raise ActionKitRest::Response::UnknownServerError, error_message(response)
end
else
raise StandardError, error_message(response)
raise ActionKitRest::Response::UnknownServerError, error_message(response)
end
end
end
Expand All @@ -37,6 +37,8 @@ def error_message(response)
end
end

class UnknownServerError < StandardError; end

class TryAgainLater < StandardError; end

class NotFound < StandardError; end
Expand Down

0 comments on commit 19efd3c

Please sign in to comment.