Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 713f749

Browse files
Remove test route and capture unknown exceptions in sentry
1 parent 3078ffa commit 713f749

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

app/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212

1313
def create_app(test_config=None):
14+
# -- App Config --
1415
app = Flask(
1516
__name__,
1617
instance_relative_config=True,
@@ -56,9 +57,6 @@ def before_request():
5657
request.scheme = app.config["PREFERRED_URL_SCHEME"]
5758

5859
# --- Routes ---
59-
@app.route('/debug-sentry')
60-
def trigger_error():
61-
division_by_zero = 1 / 0
6260

6361
# --- Controllers ---
6462
from app.http.controllers import dashboard_controller

app/http/controllers/dashboard_controller.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1+
import csv
2+
import os
3+
import tempfile
14
import tracemalloc
25
from time import time
3-
from typing import Union
46

5-
from flask import Blueprint, Response, jsonify, request
6-
from flask_inertia import lazy_include, render_inertia
7-
import sympy as sp
87
import numpy as np
8+
import sympy as sp
9+
from flask import Blueprint, request
10+
from flask_inertia import lazy_include, render_inertia
911
from picos import SolutionFailure
10-
import os
11-
import csv
12-
import tempfile
13-
12+
from sentry_sdk import capture_exception
1413
from werkzeug.datastructures.file_storage import FileStorage
1514

16-
import tests
1715
from app.models.safety_barrier import SafetyBarrier
1816
from app.models.stability import Stability
1917

2018
bp = Blueprint("dashboard", __name__)
2119

20+
2221
def calculate_result() -> dict:
2322
"""
2423
Calculate the result of the user's input.
@@ -50,6 +49,7 @@ def calculate_result() -> dict:
5049
"error": "An unknown error occurred.",
5150
"description": str(e),
5251
}
52+
capture_exception(e)
5353

5454
time_taken = time() - start_time
5555

@@ -138,6 +138,7 @@ def index():
138138
},
139139
)
140140

141+
141142
def _parse_uploaded_files(data: dict) -> dict:
142143
"""
143144
Parse the uploaded files and add them to the data dictionary.
@@ -173,6 +174,7 @@ def _parse_uploaded_files(data: dict) -> dict:
173174

174175
return data
175176

177+
176178
def __load_mosek_license(_file: FileStorage) -> bool:
177179
"""
178180
Read the MOSEK licence file into this request.
@@ -186,4 +188,4 @@ def __load_mosek_license(_file: FileStorage) -> bool:
186188

187189
temp.close()
188190

189-
return True
191+
return True

0 commit comments

Comments
 (0)