From 9b656fd9e45e3958c7357cc3a1309bc320f30dd1 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Thu, 2 Jan 2025 15:24:32 +0100 Subject: [PATCH] [IMP] compiler: add prop suffix name in the error message Without this, you only get the following error: ``` UncaughtPromiseError > OwlError Uncaught promise > Invalid prop suffix OwlError: Invalid prop suffix ``` Which is not helping much to find the problematic code. --- src/compiler/code_generator.ts | 2 +- tests/components/props.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/code_generator.ts b/src/compiler/code_generator.ts index a84e8bc7..4cbab34e 100644 --- a/src/compiler/code_generator.ts +++ b/src/compiler/code_generator.ts @@ -1156,7 +1156,7 @@ export class CodeGenerator { case "translate": break; default: - throw new OwlError("Invalid prop suffix"); + throw new OwlError(`Invalid prop suffix: ${suffix}`); } } name = /^[a-z_]+$/i.test(name) ? name : `'${name}'`; diff --git a/tests/components/props.test.ts b/tests/components/props.test.ts index 54030412..2611e435 100644 --- a/tests/components/props.test.ts +++ b/tests/components/props.test.ts @@ -339,7 +339,7 @@ test("throw if prop uses an unknown suffix", async () => { await expect(async () => { await mount(Parent, fixture); - }).rejects.toThrowError("Invalid prop suffix"); + }).rejects.toThrowError("Invalid prop suffix: somesuffix"); }); test(".alike suffix in a simple case", async () => {