Skip to content

Commit

Permalink
Standardize
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Jan 15, 2024
1 parent 6ad46b9 commit 1763ce1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/noticed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ class ValidationError < StandardError
class ResponseUnsuccessful < StandardError
attr_reader :response

def initialize(response)
def initialize(response, url)
@response = response
@url = url

super("Request to returned #{response.code} response")
super("POST request to #{url} returned #{response.code} response:\n#{response.body.inspect}")
end
end
end
2 changes: 1 addition & 1 deletion lib/noticed/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def post_request(url, args = {})
response = http.request(request)
logger.debug("Response: #{response.code}: #{response.body.inspect}")

raise ResponseUnsuccessful.new(response) unless response.code.start_with?("20")
raise ResponseUnsuccessful.new(request, response, http) unless response.code.start_with?("20")

response
end
Expand Down

0 comments on commit 1763ce1

Please sign in to comment.