diff --git a/ui/store.ts b/ui/store.ts index fa2ee4e..82bb02f 100644 --- a/ui/store.ts +++ b/ui/store.ts @@ -177,7 +177,7 @@ export async function xhrRequest( const err = new Error(); err["message"] = xhr.status === 0 - ? "Server is unrachable" + ? "Server is unreachable" : `Unexpected response status code ${xhr.status}`; err["code"] = xhr.status; err["response"] = xhr.responseText; @@ -388,7 +388,7 @@ function _fulfill( extract: (xhr) => { if (xhr.status === 403) throw new Error("Not authorized"); if (!xhr.status) { - throw new Error("Server is unrachable"); + throw new Error("Server is unreachable"); } else if (xhr.status !== 200) { throw new Error( `Unexpected response status code ${xhr.status}` @@ -608,6 +608,7 @@ export function postTasks( body: tasks, extract: (xhr) => { if (xhr.status === 403) throw new Error("Not authorized"); + if (!xhr.status) throw new Error("Server is unreachable"); if (xhr.status !== 200) throw new Error(xhr.response); const connectionRequestStatus = xhr.getResponseHeader( "Connection-Request" @@ -679,7 +680,7 @@ export function resourceExists(resource: string, id: string): Promise { }), extract: (xhr) => { if (xhr.status === 403) throw new Error("Not authorized"); - if (!xhr.status) throw new Error("Server is unrachable"); + if (!xhr.status) throw new Error("Server is unreachable"); else if (xhr.status !== 200) throw new Error(`Unexpected response status code ${xhr.status}`); return +xhr.getResponseHeader("x-total-count");