Skip to content

Commit 61dbacd

Browse files
authored
Improve exception handling (#2337)
1 parent c7a8c12 commit 61dbacd

File tree

1 file changed

+2
-2
lines changed
  • python/samples/demos/chatkit-integration

1 file changed

+2
-2
lines changed

python/samples/demos/chatkit-integration/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ async def upload_file(attachment_id: str, file: UploadFile = File(...)):
589589

590590
except Exception as e:
591591
logger.error(f"Error uploading file for attachment {attachment_id}: {e}", exc_info=True)
592-
return JSONResponse(status_code=500, content={"error": f"Failed to upload file: {str(e)}"})
592+
return JSONResponse(status_code=500, content={"error": "Failed to upload file."})
593593

594594

595595
@app.get("/preview/{attachment_id}")
@@ -620,7 +620,7 @@ async def preview_image(attachment_id: str):
620620

621621
except Exception as e:
622622
logger.error(f"Error serving preview for attachment {attachment_id}: {e}", exc_info=True)
623-
return JSONResponse(status_code=500, content={"error": str(e)})
623+
return JSONResponse(status_code=500, content={"error": "Error serving preview for attachment."})
624624

625625

626626
if __name__ == "__main__":

0 commit comments

Comments
 (0)