Skip to content

Commit

Permalink
[FIX] Redundant error handling
Browse files Browse the repository at this point in the history
raise_for_status() raises the same exception, with the response's _content
available from the exception's `response` attribute. Moreover, passing the
headers as a positional argument when creating the exception makes the
api key from the authorization header show up in the string representation
of the exception in logs and messages.
  • Loading branch information
StefanRijnhart authored and MPoch-PlanetaTIC committed Jul 3, 2023
1 parent 493c652 commit fa7dd82
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions connector_magento/components/backend_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ def call(self, resource_path, arguments, http_method=None, storeview=None):
elif arguments is not None:
kwargs['json'] = arguments
res = function(url, **kwargs)
if (res.status_code == 400 and res._content):
raise requests.HTTPError(
url, res.status_code, res._content, headers, __name__)
res.raise_for_status()
return res.json()

Expand Down

0 comments on commit fa7dd82

Please sign in to comment.