mirror of
https://github.com/karma-riuk/crab-webapp.git
synced 2025-07-05 06:08:13 +02:00
instead of raising an error (which is a server
issue), returning a 400 / 404 correctly
This commit is contained in:
@ -113,7 +113,7 @@ def submit_refinement():
|
|||||||
@router.route('/status/<id>')
|
@router.route('/status/<id>')
|
||||||
def status(id):
|
def status(id):
|
||||||
if id not in request2status:
|
if id not in request2status:
|
||||||
raise ValueError(f"Id {id} doesn't exist")
|
return jsonify({"error": "Id doens't exist", "message": f"Id {id} doesn't exist"}), 404
|
||||||
|
|
||||||
subject = request2status[id]
|
subject = request2status[id]
|
||||||
if subject.status == Status.COMPLETE:
|
if subject.status == Status.COMPLETE:
|
||||||
@ -126,8 +126,14 @@ def status(id):
|
|||||||
request2status[id] = subject
|
request2status[id] = subject
|
||||||
if sid:
|
if sid:
|
||||||
if sid in socket2observer:
|
if sid in socket2observer:
|
||||||
raise AttributeError(
|
return (
|
||||||
"You are already seeing the real-time progress of that request, please don't spam"
|
jsonify(
|
||||||
|
{
|
||||||
|
"error": "Already listening",
|
||||||
|
"message": f"You are already seeing the real-time progress of that request, please don't spam",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
400,
|
||||||
)
|
)
|
||||||
|
|
||||||
obs = SocketObserver(socket_emit)
|
obs = SocketObserver(socket_emit)
|
||||||
|
Reference in New Issue
Block a user