In the Android Core API v2 SDK, when a Dropbox access token becomes invalid, I want to catch that exception and null out my copy of the access token so the linking authorization will be done again. The trouble is, I don't know how to exactly qualify that particular exception. For testing purposes I have deliberately fed the wrong access token to the API (rather than invalidate the actual token with Dropbox). For me, the exception happens on listFolder(). And the exception thrown is the DbxException. Buy why isn't it the InvalidAccessTokenException? Apparently that is a real thing, a subclass of DbxException. But it does not check with:
if(e instanceof InvalidAccessTokenException)
but only with:
if(e instanceof DbxException)
If there are any other reasons for any of these API functions to throw a DbxException besides an invalid access token, it would be wrong for me to pretend that the access token is the only problem. So I would like to detect when this specific exception is thrown, as distinct from all others.