Skip to content

Commit

Permalink
print logs when failed get presigned url
Browse files Browse the repository at this point in the history
  • Loading branch information
danangmassandy committed May 2, 2024
1 parent 416ec0b commit e3f2b4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion django_project/cplus_api/utils/api_helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import math
import traceback
import logging
from datetime import timedelta
from rest_framework.exceptions import PermissionDenied
from drf_yasg import openapi
Expand All @@ -11,6 +13,7 @@
from cplus_api.models.scenario import ScenarioTask


logger = logging.getLogger(__name__)
LAYER_API_TAG = '01-layer'
SCENARIO_API_TAG = '02-scenario-analysis'
SCENARIO_OUTPUT_API_TAG = '03-scenario-outputs'
Expand Down Expand Up @@ -113,7 +116,11 @@ def get_presigned_url(filename):
os.environ.get("MINIO_BUCKET_NAME"), filename,
expires=timedelta(hours=3))
return build_minio_absolute_url(upload_url)
except S3Error:
except S3Error as exc:
logger.error(f'Unexpected exception occured: {type(exc).__name__} '
'in get_presigned_url')
logger.error(exc)
logger.error(traceback.format_exc())
return None


Expand Down

0 comments on commit e3f2b4e

Please sign in to comment.