Fix typos

This commit is contained in:
Zaid Abdulla committed 2020-10-26 15:29:03 -07:00
1 parent 92091b52a2
commit 04a7c08a20
1 file changed
+4 -3
+4 -3
View File
@@ -177,7 +177,7 @@ export async function xhrRequest(
const err = new Error(); const err = new Error();
err["message"] = err["message"] =
xhr.status === 0 xhr.status === 0
? "Server is unrachable" ? "Server is unreachable"
: `Unexpected response status code ${xhr.status}`; : `Unexpected response status code ${xhr.status}`;
err["code"] = xhr.status; err["code"] = xhr.status;
err["response"] = xhr.responseText; err["response"] = xhr.responseText;
@@ -388,7 +388,7 @@ function _fulfill(
extract: (xhr) => { extract: (xhr) => {
if (xhr.status === 403) throw new Error("Not authorized"); if (xhr.status === 403) throw new Error("Not authorized");
if (!xhr.status) { if (!xhr.status) {
throw new Error("Server is unrachable"); throw new Error("Server is unreachable");
} else if (xhr.status !== 200) { } else if (xhr.status !== 200) {
throw new Error( throw new Error(
`Unexpected response status code ${xhr.status}` `Unexpected response status code ${xhr.status}`
@@ -608,6 +608,7 @@ export function postTasks(
body: tasks, body: tasks,
extract: (xhr) => { extract: (xhr) => {
if (xhr.status === 403) throw new Error("Not authorized"); 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); if (xhr.status !== 200) throw new Error(xhr.response);
const connectionRequestStatus = xhr.getResponseHeader( const connectionRequestStatus = xhr.getResponseHeader(
"Connection-Request" "Connection-Request"
@@ -679,7 +680,7 @@ export function resourceExists(resource: string, id: string): Promise<number> {
}), }),
extract: (xhr) => { extract: (xhr) => {
if (xhr.status === 403) throw new Error("Not authorized"); 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) else if (xhr.status !== 200)
throw new Error(`Unexpected response status code ${xhr.status}`); throw new Error(`Unexpected response status code ${xhr.status}`);
return +xhr.getResponseHeader("x-total-count"); return +xhr.getResponseHeader("x-total-count");