diff options
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, { |