Skip to content

Exceptions in refresh are handled properly and 401s prompt a retry - #5

Merged
hedgehogowainbrown merged 8 commits into
mainfrom
improve-refresh
Jan 26, 2026
Merged

hedgehogowainbrown merged 8 commits into
mainfrom
improve-refresh

Conversation

@HelenaSewell

@HelenaSewell HelenaSewell commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

Overview

  • I have performed a self review of my code
  • I have made corresponding changes to the documentation
  • I have commented my code, particularly in hard-to-understand areas
  • I have added sufficient logging
  • New and existing tests pass locally with my changes
  • The code modified as part of this PR has been covered with tests

Flowchart

Flow chart showing interceptor logic

@hedgehogowainbrown

Copy link
Copy Markdown
Contributor

@HelenaSewell thanks for the diagram, that's very useful. I'd question this case:

image

If authorisation is a requirement of a given API, or if it changes behaviour for un-authed requests, would we always want to send that request?

@HelenaSewell

Copy link
Copy Markdown
Contributor Author

@HelenaSewell thanks for the diagram, that's very useful. I'd question this case:

If authorisation is a requirement of a given API, or if it changes behaviour for un-authed requests, would we always want to send that request?

Hmm, what do you think would be a better option? I could add in a callback for this specific case. Or maybe I could call onError with the error from the refresh request?
My thinking was to try and make all "auth errors" consistently end up with 401s so they can be easily handled together. Having the failed refresh passed back would result in a 400 instead, which makes it more difficult to handle with other auth errors.

@hedgehogowainbrown
hedgehogowainbrown merged commit 35adccd into main Jan 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants