From 4eace73f5194644a2d89df05b705df2b7e10d97b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 3 Oct 2025 19:24:26 -0300 Subject: checks: factor out find() decorators, annotate multipleNameMatches --- src/find.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/find.js') diff --git a/src/find.js b/src/find.js index b44c1bb2..7b605e97 100644 --- a/src/find.js +++ b/src/find.js @@ -140,12 +140,19 @@ function oopsMultipleNameMatches(mode, { normalizedName, multipleNameMatches, }) { - return warnOrThrow(mode, - `Multiple matches for reference "${name}". Please resolve:\n` + - multipleNameMatches[normalizedName] - .map(match => `- ${inspect(match)}\n`) - .join('') + - `Returning null for this reference.`); + try { + return warnOrThrow(mode, + `Multiple matches for reference "${name}". Please resolve:\n` + + multipleNameMatches[normalizedName] + .map(match => `- ${inspect(match)}\n`) + .join('') + + `Returning null for this reference.`); + } catch (caughtError) { + throw Object.assign(caughtError, { + [Symbol.for('hsmusic.find.multipleNameMatches')]: + multipleNameMatches[normalizedName], + }); + } } function oopsNameCapitalizationMismatch(mode, { -- cgit 1.3.0-6-gf8a5