summaryrefslogtreecommitdiff
path: root/ui/lib/apiServer.js
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-05-08 20:04:04 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-05-08 20:04:04 -0400
commit1932ef679bcfde08cb1348500a1f0f454e8ecf3f (patch)
tree4c54ad5ae840a076c7cd5175eee2e55e3e37aa15 /ui/lib/apiServer.js
parent7ab4d321d546818f702ecb363e41b899fc416a7e (diff)
parent92266a13bfabf7b29f08bc85d0e8efba467167da (diff)
Merge branch 'prop/outbox-message-ui'
Diffstat (limited to 'ui/lib/apiServer.js')
-rw-r--r--ui/lib/apiServer.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js
index cad8997..e682681 100644
--- a/ui/lib/apiServer.js
+++ b/ui/lib/apiServer.js
@@ -87,5 +87,21 @@ function responseError(err) {
}
function isRetryable(err) {
- return !!err.request;
+ // See <https://axios-http.com/docs/handling_errors> for a breakdown of this logic.
+
+ // Any error with a response is non-retryable. The server responded; we get to act on that
+ // response. We don't do anything special for 5xx-series responses yet, but they might one day be
+ // retryable too.
+ if (err.response) {
+ return false;
+ }
+
+ // Any error with no response and a request is probably from the network side of things, and is
+ // retryable.
+ if (err.request) {
+ return true;
+ }
+
+ // Anything with neither is unexpected enough that we should not try it.
+ return false;
}