Improve AccessTokenUnavailableException error message
cesarcneto opened this issue · 1 comments
Recently I was facing an issue where I was having a hard time to understand why an exception being thrown. I had the following scenario:
- accessTokens internal map correctly fetched my token with, say, tokenId "my-app"
- And, due to a type, I was using tokenId parameter as "my-app'" (note the additional single quote)
As I mentioned, I was receiving an exception like:
Caused by: org.zalando.stups.tokens.AccessTokenUnavailableException: no token available at org.zalando.stups.tokens.AbstractAccessTokenRefresher.getAccessToken(AbstractAccessTokenRefresher.java:83) ~[tokens-0.11.0-beta-2.jar:na]
Having a error message like "no token avaiable" is not helpfull at all.
At that moment in the code, we could add to the error message something like:
"No token available for tokenId [tokenId]. Tokens are available for the following tokenIds [<list_of_tokenIds_available>]"
What do you think?
I myself could work on this issue if you all agree.
I like the idea. The only point to keep in mind IMHO is to make sure it's done efficiently.