From d6c9e657805488f4f8f0f4acfeae2bf8efea9742 Mon Sep 17 00:00:00 2001 From: tharvik Date: Mon, 2 Dec 2024 23:51:53 +0100 Subject: [PATCH] fixup! tmp: debug github actions --- discojs/src/client/client.ts | 5 +---- discojs/src/task/task_handler.ts | 10 ++-------- .../src/components/testing/__tests__/Testing.spec.ts | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/discojs/src/client/client.ts b/discojs/src/client/client.ts index fe4530dae..795f9346e 100644 --- a/discojs/src/client/client.ts +++ b/discojs/src/client/client.ts @@ -178,10 +178,7 @@ export abstract class Client extends EventEmitter<{'status': RoundStatus}>{ url.pathname += `tasks/${this.task.id}/model.json` const response = await fetch(url); - if (!response.ok) { - console.log("Error with response ok") - throw new Error(`fetch: HTTP status ${response.status}`); - } + if (!response.ok) throw new Error(`fetch: HTTP status ${response.status}`); const encoded = new Uint8Array(await response.arrayBuffer()) return await serialization.model.decode(encoded) diff --git a/discojs/src/task/task_handler.ts b/discojs/src/task/task_handler.ts index cd5f5d1c3..d2b692bb4 100644 --- a/discojs/src/task/task_handler.ts +++ b/discojs/src/task/task_handler.ts @@ -28,20 +28,14 @@ export async function pushTask( weights: await serialization.weights.encode(model.weights), }), }); - if (!response.ok) { - console.log("Error with response ok") - throw new Error(`fetch: HTTP status ${response.status}`); - } + if (!response.ok) throw new Error(`fetch: HTTP status ${response.status}`); } export async function fetchTasks( base: URL, ): Promise>> { const response = await fetch(urlToTasks(base)); - if (!response.ok) { - console.log("Error with response ok") - throw new Error(`fetch: HTTP status ${response.status}`); - } + if (!response.ok) throw new Error(`fetch: HTTP status ${response.status}`); const tasks: unknown = await response.json(); if (!Array.isArray(tasks)) { diff --git a/webapp/src/components/testing/__tests__/Testing.spec.ts b/webapp/src/components/testing/__tests__/Testing.spec.ts index fccfacc14..7cd5d62dd 100644 --- a/webapp/src/components/testing/__tests__/Testing.spec.ts +++ b/webapp/src/components/testing/__tests__/Testing.spec.ts @@ -60,7 +60,7 @@ it("shows stored models", async () => { it("allows to download server's models", async () => { vi.stubGlobal("fetch", async (url: string | URL) => { if (url.toString() === "http://localhost:8080/tasks") - return { ok: () => true, json: () => Promise.resolve([TASK]) }; + return { json: () => Promise.resolve([TASK]) }; throw new Error(`unhandled get: ${url}`); }); afterEach(() => {