diff --git a/src/cloudforet/cost_analysis/connector/azure_cost_mgmt_connector.py b/src/cloudforet/cost_analysis/connector/azure_cost_mgmt_connector.py index 5b43c53..0537578 100644 --- a/src/cloudforet/cost_analysis/connector/azure_cost_mgmt_connector.py +++ b/src/cloudforet/cost_analysis/connector/azure_cost_mgmt_connector.py @@ -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) diff --git a/src/cloudforet/cost_analysis/error/cost.py b/src/cloudforet/cost_analysis/error/cost.py index d805663..eb7a145 100644 --- a/src/cloudforet/cost_analysis/error/cost.py +++ b/src/cloudforet/cost_analysis/error/cost.py @@ -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}'