aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/routes/api/v1/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src/routes/api/v1/index.ts')
-rw-r--r--packages/server/src/routes/api/v1/index.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/server/src/routes/api/v1/index.ts b/packages/server/src/routes/api/v1/index.ts
index fa7d8ab..fb9cd8a 100644
--- a/packages/server/src/routes/api/v1/index.ts
+++ b/packages/server/src/routes/api/v1/index.ts
@@ -9,6 +9,12 @@ import { ServerError } from "../../../git/error";
function setHandlers(fastify: FastifyInstance): void {
fastify.setErrorHandler((err, req, reply) => {
console.log(err);
+
+ if(err.validation) {
+ reply.code(400).send({ error: `${err.validation[0].dataPath} ${err.validation[0].message}` });
+ return;
+ }
+
reply.code(500).send({ error: "Internal server error!" });
});
fastify.setNotFoundHandler((req, reply) => {