summaryrefslogtreecommitdiff
path: root/ui/lib/apiServer.js
diff options
context:
space:
mode:
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;
}