Skip to content

Commit

Permalink
Changed the format to use async/await rather than promise.catch()
Browse files Browse the repository at this point in the history
  • Loading branch information
SatapasT committed Jul 8, 2024
1 parent 3ad6d2f commit 6c6c2f0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/src/routes/megateams/megateam_handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<number> {
try {
return await z.coerce.number().parseAsync(value)
} catch {
return 0
}
}

async getMegateamsList(this: void, _request: Request, response: Response): Promise<void> {
const result = await Megateam.findAll({
Expand Down

0 comments on commit 6c6c2f0

Please sign in to comment.