From d2128677eb2b7eed132ee03ea715366e1c37d3dd Mon Sep 17 00:00:00 2001 From: Martijn Pieters Date: Fri, 17 Mar 2023 12:28:31 +0000 Subject: [PATCH] :lipstick: show constraint messages, not names When header validation fails, the constraint message is the human-friendly error string, show that instead of the constraint name. --- lib/features/validate-headers/impl.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/features/validate-headers/impl.ts b/lib/features/validate-headers/impl.ts index 3c54612..edc8ced 100644 --- a/lib/features/validate-headers/impl.ts +++ b/lib/features/validate-headers/impl.ts @@ -52,7 +52,11 @@ export class ValidateHeaders extends Feature { }); if (errors.length > 0) { - throw new Error(errors.map((err) => err.toString()).join('\n')); + throw new Error( + errors + .map((err) => err.toString(undefined, undefined, undefined, true)) + .join('\n'), + ); } }