Improve error handling during the token refresh process.