Incorrect Error Handling After Successful Token Refresh
[!NOTE]
After a successful token refresh, an error occurs during the retry of the original request. Instead of handling the new error, the initial authentication error (401 Unauthorized) is mistakenly thrown again.
[!TIP] This incorrect error handling prevents the app from responding properly to different errors after the refresh token process.
Steps to Reproduce:
- Trigger a token refresh process.
- During the retry of the request with the new token, cause a different error (e.g., server error).
- Observe that the original
401 Unauthorizederror is thrown instead of the new error.
[!WARNING]
This issue affects error handling across the application and can lead to confusion during the retry process, as unrelated errors are not being captured correctly.
Expected Behavior:
[!IMPORTANT]
The new error should be caught and handled correctly after the token refresh process.
Proposed Solution:
[!CAUTION] Ensure that any new errors encountered after a token refresh are handled properly, without reusing the initial error.