Catch exceptions when trying to read HTTP body in logs
Fixes https://sentry.io/organizations/coreos/issues/627586398/events/9ea9873f11e6456abc58f5de10951e44/?project=52148
This commit is contained in:
parent
166fd671c8
commit
68300b2644
1 changed files with 6 additions and 1 deletions
7
app.py
7
app.py
|
@ -11,6 +11,7 @@ from flask_login import LoginManager
|
|||
from flask_mail import Mail
|
||||
from flask_principal import Principal
|
||||
from jwkest.jwk import RSAKey
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
import features
|
||||
|
||||
|
@ -143,7 +144,11 @@ FILTERED_VALUES = [
|
|||
|
||||
@app.after_request
|
||||
def _request_end(resp):
|
||||
jsonbody = request.get_json(force=True, silent=True)
|
||||
try:
|
||||
jsonbody = request.get_json(force=True, silent=True)
|
||||
except HTTPException:
|
||||
jsonbody = None
|
||||
|
||||
values = request.values.to_dict()
|
||||
|
||||
if jsonbody and not isinstance(jsonbody, dict):
|
||||
|
|
Reference in a new issue