Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add data about the request to http errors
not super pumped about the monkey patching, but this will be useful for adding context to API errors
- Loading branch information
1 parent
8db8a8f
commit 97282c2
Showing
3 changed files
with
93 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
# Module gets mixed in to Net::HTTP exception classes so we can attach our | ||
# RESTRequest object to them and get the request parameters back out later. | ||
module ChefNetHTTPExceptionExtensions | ||
attr_accessor :chef_rest_request | ||
end | ||
|
||
require 'net/http' | ||
module Net | ||
class HTTPError | ||
include ChefNetHTTPExceptionExtensions | ||
end | ||
class HTTPRetriableError | ||
include ChefNetHTTPExceptionExtensions | ||
end | ||
class HTTPServerException | ||
include ChefNetHTTPExceptionExtensions | ||
end | ||
class HTTPFatalError | ||
include ChefNetHTTPExceptionExtensions | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters