Skip to content

Commit da44eee

Browse files
committed
refactor(walkers): streamline error response handling in route
Use Fastify's reply chain to send error responses directly instead of returning Error objects. This ensures proper HTTP status codes and error messages are sent to the client.
1 parent d20cf0e commit da44eee

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/routes/walkers/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ const routes: FastifyPluginAsync = async (server) => {
8787
},
8888
(request, reply) => {
8989
if (!request?.dbuser) {
90-
reply.code(401);
91-
return new Error("Invalid token JWT");
90+
return reply.code(401).send("Invalid token JWT");
9291
}
9392
if (!request?.dbuser.clanid) {
94-
reply.code(405);
95-
return new Error("No clan");
93+
return reply.code(405).send("No clan");
9694
}
9795

9896
let pageSize: number =

0 commit comments

Comments
 (0)