Give a more helpful error when token has expired

We’ve seen quite a few developers encounter the `Invalid token: expired`
error message when they’re getting started using the Notify API. When
this happens they either raise a support ticket or ask for help on
Slack.

In every case this has been because the clock on their
machine/environment/container isn’t accurate. The error message doesn’t
help them figure this out.

This commit adds extra detail to the error message so they can fix the
problem without having to come to us for help.
This commit is contained in:
Chris Hill-Scott
2017-01-17 10:44:00 +00:00
parent 56f1ed11d6
commit b6b9b3b225
2 changed files with 4 additions and 2 deletions

View File

@@ -94,4 +94,4 @@ def get_decode_errors(auth_token, unsigned_secret):
try:
decode_jwt_token(auth_token, unsigned_secret)
except TokenExpiredError:
raise AuthError("Invalid token: expired", 403)
raise AuthError("Invalid token: expired, check that your system clock is accurate", 403)