From 377a5b2dbd2c136010bf0b8e04ab5f1ea68cc61f Mon Sep 17 00:00:00 2001 From: "Lewis Kim (Sunghyun Kim)" Date: Sat, 21 Jul 2018 13:21:29 +0900 Subject: [PATCH] TEMP UPDATE: for hide stacktrace. visit https://github.com/graphql-python/flask-graphql/issues/49 https://github.com/graphql-python/flask-graphql/issues/49 --- flask_graphql_auth/decorators.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/flask_graphql_auth/decorators.py b/flask_graphql_auth/decorators.py index a28bfa7..548aa2b 100644 --- a/flask_graphql_auth/decorators.py +++ b/flask_graphql_auth/decorators.py @@ -88,7 +88,11 @@ def jwt_required(fn): @wraps(fn) def wrapper(*args, **kwargs): token = kwargs.pop(current_app.config['JWT_TOKEN_ARGUMENT_NAME']) - verify_jwt_in_argument(token) + try: + verify_jwt_in_argument(token) + except Exception as e: + return GraphQLError(e) + return fn(*args, **kwargs) return wrapper @@ -103,6 +107,10 @@ def jwt_refresh_token_required(fn): @wraps(fn) def wrapper(*args, **kwargs): token = kwargs.pop(current_app.config['JWT_TOKEN_ARGUMENT_NAME']) - verify_refresh_jwt_in_argument(token) + try: + verify_refresh_jwt_in_argument(token) + except Exception as e: + return GraphQLError(e) + return fn(*args, **kwargs) return wrapper