diff --git a/src/cli.ts b/src/cli.ts index 3a1b98e..15fb4da 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -88,7 +88,8 @@ void (async () => { if (!confirmed) return // initiate LibreScore link request - librescoreLink = getLibreScoreLink(scoreinfo, true) + librescoreLink = getLibreScoreLink(scoreinfo) + librescoreLink.catch(() => '') // silence this unhandled Promise rejection // print a blank line to the terminal console.log() @@ -134,7 +135,9 @@ void (async () => { } catch (err) { spinner.fail(err.message) spinner.info( - "Send your URL to the #dataset-bugs channel in the LibreScore Community Discord server:\n https://discord.gg/kTyx6nUjMv"); + 'Send your URL to the #dataset-bugs channel in the LibreScore Community Discord server:\n ' + + 'https://discord.gg/kTyx6nUjMv', + ) return } spinner.succeed('OK\n') diff --git a/src/librescore-link.ts b/src/librescore-link.ts index bdcc5cf..04d8044 100644 --- a/src/librescore-link.ts +++ b/src/librescore-link.ts @@ -6,7 +6,7 @@ const _getLink = (scorepack: string) => { return `https://librescore.org/score/${scorepack}` } -export const getLibreScoreLink = async (scoreinfo: ScoreInfo, isMsdl: boolean, _fetch = getFetch()): Promise => { +export const getLibreScoreLink = async (scoreinfo: ScoreInfo, _fetch = getFetch()): Promise => { const mainCid = await getMainCid(scoreinfo, _fetch) const ref = scoreinfo.getScorepackRef(mainCid) const url = `https://ipfs.infura.io:5001/api/v0/dag/get?arg=${ref}` @@ -16,7 +16,7 @@ export const getLibreScoreLink = async (scoreinfo: ScoreInfo, isMsdl: boolean, _ assertRes(r0) } const res: { Message: string } | string = await r0.json() - if (typeof res !== 'string' && !isMsdl) { + if (typeof res !== 'string') { // read further error msg throw new Error(res.Message) }