⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
refactor: replace Error with HTTPException
Andrejfafc9b666768
diff --git a/apps/api/src/project/controllers/get-public-project.ts b/apps/api/src/project/controllers/get-public-project.tsindex d78f3cc30..3dfdc5efe 100644--- a/apps/api/src/project/controllers/get-public-project.ts+++ b/apps/api/src/project/controllers/get-public-project.ts@@ -1,14 +1,19 @@+import { HTTPException } from "hono/http-exception";import getTasks from "../../task/controllers/get-tasks";export async function getPublicProject(id: string) {const project = await getTasks(id);if (!project) {- throw new Error("Project not found");+ throw new HTTPException(404, {+ message: "Project not found",+ });}if (!project.isPublic) {- throw new Error("Project is not public");+ throw new HTTPException(403, {+ message: "Project is not public",+ });}return project;diff --git a/apps/api/src/user/controllers/sign-in.ts b/apps/api/src/user/controllers/sign-in.tsindex 2d921489c..db3f1d68a 100644--- a/apps/api/src/user/controllers/sign-in.ts+++ b/apps/api/src/user/controllers/sign-in.ts@@ -1,4 +1,5 @@import bcrypt from "bcrypt";+import { HTTPException } from "hono/http-exception";import db from "../../database";async function signIn(email: string, password: string) {@@ -7,13 +8,17 @@ async function signIn(email: string, password: string) {});if (!user) {- throw new Error("User not found");+ throw new HTTPException(404, {+ message: "User not found",+ });}const isPasswordValid = await bcrypt.compare(password, user.password);if (!isPasswordValid) {- throw new Error("Invalid credentials");+ throw new HTTPException(401, {+ message: "Invalid credentials",+ });}return {diff --git a/apps/web/src/fetchers/user/sign-in.ts b/apps/web/src/fetchers/user/sign-in.tsindex fd99b2e52..7a5b3d962 100644--- a/apps/web/src/fetchers/user/sign-in.ts+++ b/apps/web/src/fetchers/user/sign-in.ts@@ -11,6 +11,7 @@ const signIn = async ({ email, password }: SignInFormValues) => {if (!response.ok) {const error = await response.text();+ console.log(error);throw new Error(error);}