Skip to content

Commit

Permalink
error
Browse files Browse the repository at this point in the history
  • Loading branch information
jairomr authored Nov 22, 2024
1 parent a226718 commit 38bc95b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,17 @@ def gee_credentials(private_key_file):

@app.exception_handler(StarletteHTTPException)
async def http_exception_handler(request, exc):
start_code = exc.status_code
logger.info(exc)

start_code = str(exc.status_code)
if request.url.path.split('/')[1] == 'api':
try:
return JSONResponse(
content={'status_code': start_code, 'message': exc.detail},
content={'status_code': start_code, 'message': str(exc.detail)},
status_code=start_code,
headers=exc.headers,
)
except:
return JSONResponse(
content={'status_code': start_code, 'message': exc.detail},
content={'status_code': start_code, 'message': str(exc.detail)},
status_code=start_code
)

Expand Down

0 comments on commit 38bc95b

Please sign in to comment.