Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): use HttpError for activity fetcher

justin7f1193f3b19e
diff --git a/apps/web/src/fetchers/activity/get-activites-by-task-id.ts b/apps/web/src/fetchers/activity/get-activites-by-task-id.ts
index 2fa7a99c3..f026f206e 100644
--- a/apps/web/src/fetchers/activity/get-activites-by-task-id.ts
+++ b/apps/web/src/fetchers/activity/get-activites-by-task-id.ts
@@ -1,5 +1,6 @@
import { client } from "@kaneo/libs";
import type { InferRequestType } from "hono/client";
+import { HttpError } from "@/lib/http-error";
export type GetActivitesByTaskIdRequest = InferRequestType<
(typeof client)["activity"][":taskId"]["$get"]
@@ -11,13 +12,10 @@ async function getActivitesByTaskId({ taskId }: GetActivitesByTaskIdRequest) {
});
if (!response.ok) {
- const error = await response.text();
- throw new Error(error);
+ throw new HttpError(response.status, await response.text());
}
- const data = await response.json();
-
- return data;
+ return response.json();
}
export default getActivitesByTaskId;