Skip to content

Commit 4ee6722

Browse files
committed
Add response code to error message
1 parent de97370 commit 4ee6722

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/blueapi/blueapi.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function submitTask(request: BlueApiRequestBody): Promise<string | void> {
8080
}).then((res) => {
8181
if (!res.ok) {
8282
throw new Error(
83-
`Unable to POST request, response error ${res.statusText}`
83+
`Unable to POST request, response error ${res.status} ${res.statusText}`
8484
);
8585
}
8686
res.json().then((res) => res["task_id"]);
@@ -90,7 +90,9 @@ function submitTask(request: BlueApiRequestBody): Promise<string | void> {
9090
function runTask(taskId: string): Promise<string | void> {
9191
return blueApiCall("/worker/task", "PUT", { task_id: taskId }).then((res) => {
9292
if (!res.ok) {
93-
throw new Error(`Unable to run task, response error ${res.statusText}`);
93+
throw new Error(
94+
`Unable to run task, response error ${res.status} ${res.statusText}`
95+
);
9496
}
9597
res.json().then((res) => res["task_id"]);
9698
});
@@ -105,7 +107,7 @@ export function submitAndRunPlanImmediately(
105107
runTask(res);
106108
}
107109
})
108-
.catch((error) => console.log(error));
110+
.catch((error) => console.log(`NOPE ${error}`));
109111
}
110112

111113
export function abortCurrentPlan(): Promise<BlueApiWorkerState> {

0 commit comments

Comments
 (0)