diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-10-03 19:24:26 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-10-03 19:24:26 -0300 |
commit | 4eace73f5194644a2d89df05b705df2b7e10d97b (patch) | |
tree | 246ec15745901a53f9254fa68601bce87b1a0aef /src/find.js | |
parent | 84afb5dabf98b8822b3433baca8e02896df04048 (diff) |
checks: factor out find() decorators, annotate multipleNameMatches
Diffstat (limited to 'src/find.js')
-rw-r--r-- | src/find.js | 19 |
1 files changed, 13 insertions, 6 deletions
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, { |