Skip to content

Commit

Permalink
Update error.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-xhuang authored Aug 26, 2024
1 parent cd6eb68 commit 2bd24dd
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions snowflake/ingest/error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved.
# Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
from requests import Response

class IngestResponseError(Exception):
Expand All @@ -15,13 +15,17 @@ def __init__(self, response: Response):
response.reason)
return

self.code = json_body[u'code']
self.success = json_body[u'success']
self._raw_message = json_body[u'message']
self.data = json_body[u'data']
self.message = 'Http Error: {}, Vender Code: {}, Message: {}'\
.format(self.http_error_code, self.code, self._raw_message)

try:
self.code = json_body[u'code']
self.success = json_body[u'success']
self._raw_message = json_body[u'message']
self.data = json_body[u'data']
self.message = 'Http Error: {}, Vender Code: {}, Message: {}' \
.format(self.http_error_code, self.code, self._raw_message)
except KeyError:
self.message = 'Http Error: {}, Message: {}, Body: {}'.format(self.http_error_code,
response.reason,
json_body)
return

def __str__(self):
Expand Down

0 comments on commit 2bd24dd

Please sign in to comment.