Skip to content

Commit 377a5b2

Browse files
committed
1 parent 266fd5a commit 377a5b2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

flask_graphql_auth/decorators.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ def jwt_required(fn):
8888
@wraps(fn)
8989
def wrapper(*args, **kwargs):
9090
token = kwargs.pop(current_app.config['JWT_TOKEN_ARGUMENT_NAME'])
91-
verify_jwt_in_argument(token)
91+
try:
92+
verify_jwt_in_argument(token)
93+
except Exception as e:
94+
return GraphQLError(e)
95+
9296
return fn(*args, **kwargs)
9397
return wrapper
9498

@@ -103,6 +107,10 @@ def jwt_refresh_token_required(fn):
103107
@wraps(fn)
104108
def wrapper(*args, **kwargs):
105109
token = kwargs.pop(current_app.config['JWT_TOKEN_ARGUMENT_NAME'])
106-
verify_refresh_jwt_in_argument(token)
110+
try:
111+
verify_refresh_jwt_in_argument(token)
112+
except Exception as e:
113+
return GraphQLError(e)
114+
107115
return fn(*args, **kwargs)
108116
return wrapper

0 commit comments

Comments
 (0)