mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
when a post handler fails, log the traceback to the console
https://forums.ankiweb.net/t/cant-change-note-type/14809
This commit is contained in:
parent
610ef8f043
commit
7a6acc83a5
1 changed files with 9 additions and 5 deletions
|
@ -485,11 +485,15 @@ def _extract_collection_post_request(path: str) -> DynamicRequest | NotFound:
|
||||||
if handler := post_handlers.get(path):
|
if handler := post_handlers.get(path):
|
||||||
# convert bytes/None into response
|
# convert bytes/None into response
|
||||||
def wrapped() -> Response:
|
def wrapped() -> Response:
|
||||||
|
try:
|
||||||
if data := handler():
|
if data := handler():
|
||||||
response = flask.make_response(data)
|
response = flask.make_response(data)
|
||||||
response.headers["Content-Type"] = "application/binary"
|
response.headers["Content-Type"] = "application/binary"
|
||||||
else:
|
else:
|
||||||
response = flask.make_response("", HTTPStatus.NO_CONTENT)
|
response = flask.make_response("", HTTPStatus.NO_CONTENT)
|
||||||
|
except:
|
||||||
|
print(traceback.format_exc())
|
||||||
|
response = flask.make_response("", HTTPStatus.INTERNAL_SERVER_ERROR)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
return wrapped
|
return wrapped
|
||||||
|
|
Loading…
Reference in a new issue