summary refs log tree commit diff
path: root/src/api/util
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-11-29 22:22:41 +0100
committerRory& <root@rory.gay>2025-11-29 22:22:41 +0100
commit2ebe2a57fbbe177512b77b0ca6b8cca6aec858c6 (patch)
treef2f7fa54bb09d219d72b3f546aa6360801d47480 /src/api/util
parentMerge pull request #1411 from MathMan05/status (diff)
downloadserver-ts-2ebe2a57fbbe177512b77b0ca6b8cca6aec858c6.tar.xz
Cut down schemas by 90%
Diffstat (limited to 'src/api/util')
-rw-r--r--src/api/util/handlers/route.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/api/util/handlers/route.ts b/src/api/util/handlers/route.ts

index 650497a2..15cc0a19 100644 --- a/src/api/util/handlers/route.ts +++ b/src/api/util/handlers/route.ts
@@ -87,7 +87,13 @@ export interface RouteOptions { export function route(opts: RouteOptions) { let validate: AnyValidateFunction | undefined; if (opts.requestBody) { - validate = ajv.getSchema(opts.requestBody); + try { + validate = ajv.getSchema(opts.requestBody); + } catch (e) { + console.error("AJV getSchema failed!"); + throw e; + } + if (!validate) throw new Error(`Body schema ${opts.requestBody} not found`); }