fix: ask user to send Discord message when score is missing from dataset
This commit is contained in:
parent
49aef0ccf3
commit
d1c9634331
2 changed files with 7 additions and 4 deletions
|
@ -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')
|
||||
|
|
|
@ -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<string> => {
|
||||
export const getLibreScoreLink = async (scoreinfo: ScoreInfo, _fetch = getFetch()): Promise<string> => {
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue