Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Catch exceptions in process_order and return error #35

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from flask import Flask, request, json, abort
from flask import Flask, request, json, abort, jsonify
from flask_cors import CORS

import sentry_sdk
Expand Down Expand Up @@ -70,6 +70,10 @@
print "Processing order for: " + order["email"]
cart = order["cart"]

process_order(cart)
try:
process_order(cart)
except Exception as err:
sentry_sdk.capture_exception(err)
return jsonify({"error": str(err)}), 400

Check warning on line 77 in app.py

View check run for this annotation

GitHub Advanced Security / CodeQL

Information exposure through an exception

[Stack trace information](1) flows to this location and may be exposed to an external user.

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

return 'Success'
Loading