From 6c6c2f0224d1dba30cf05e886f5234fa2c2f5db3 Mon Sep 17 00:00:00 2001 From: SatapasT Date: Mon, 8 Jul 2024 18:14:23 +0100 Subject: [PATCH] Changed the format to use async/await rather than promise.catch() --- server/src/routes/megateams/megateam_handlers.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/routes/megateams/megateam_handlers.ts b/server/src/routes/megateams/megateam_handlers.ts index 82b32793..d67b691c 100644 --- a/server/src/routes/megateams/megateam_handlers.ts +++ b/server/src/routes/megateams/megateam_handlers.ts @@ -10,7 +10,13 @@ import User from "@server/database/tables/user" import Point from "@server/database/tables/point" class MegateamHandlers { - static numberParser = z.coerce.number().catch(0) + static async parseNumber(value: unknown): Promise { + try { + return await z.coerce.number().parseAsync(value) + } catch { + return 0 + } + } async getMegateamsList(this: void, _request: Request, response: Response): Promise { const result = await Megateam.findAll({