Skip to content

Commit

Permalink
feat: add error context when download cost data failed
Browse files Browse the repository at this point in the history
Signed-off-by: ImMin5 <[email protected]>
  • Loading branch information
ImMin5 committed Oct 19, 2023
1 parent 43e72af commit 2685273
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ def convert_nested_dictionary(self, cloud_svc_object):
def _download_cost_data(blob: dict) -> str:
try:
response = requests.get(blob.get('blob_link'))
if response.status_code != 200:
raise ERROR_CONNECTOR_CALL_API(reason=f'{response.reason}')
return response.text
except Exception as e:
_LOGGER.error(f'[_download_cost_data] download error: {e}', exc_info=True)
Expand Down
3 changes: 3 additions & 0 deletions src/cloudforet/cost_analysis/error/cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ class ERROR_EMPTY_CUSTOMER_TENANTS(ERROR_INVALID_ARGUMENT):

class ERROR_INVALID_TOKEN(ERROR_INVALID_ARGUMENT):
_message = 'Invalid token: {token}'

class ERROR_CONNECTOR_CALL_API(ERROR_UNKNOWN):
_message = 'API Call Error: {reason}'

0 comments on commit 2685273

Please sign in to comment.