fix: ask user to send Discord message when score is missing from dataset
This commit is contained in:
parent
49aef0ccf3
commit
d1c9634331
|
@ -88,7 +88,8 @@ void (async () => {
|
||||||
if (!confirmed) return
|
if (!confirmed) return
|
||||||
|
|
||||||
// initiate LibreScore link request
|
// 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
|
// print a blank line to the terminal
|
||||||
console.log()
|
console.log()
|
||||||
|
@ -134,7 +135,9 @@ void (async () => {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
spinner.fail(err.message)
|
spinner.fail(err.message)
|
||||||
spinner.info(
|
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
|
return
|
||||||
}
|
}
|
||||||
spinner.succeed('OK\n')
|
spinner.succeed('OK\n')
|
||||||
|
|
|
@ -6,7 +6,7 @@ const _getLink = (scorepack: string) => {
|
||||||
return `https://librescore.org/score/${scorepack}`
|
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 mainCid = await getMainCid(scoreinfo, _fetch)
|
||||||
const ref = scoreinfo.getScorepackRef(mainCid)
|
const ref = scoreinfo.getScorepackRef(mainCid)
|
||||||
const url = `https://ipfs.infura.io:5001/api/v0/dag/get?arg=${ref}`
|
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)
|
assertRes(r0)
|
||||||
}
|
}
|
||||||
const res: { Message: string } | string = await r0.json()
|
const res: { Message: string } | string = await r0.json()
|
||||||
if (typeof res !== 'string' && !isMsdl) {
|
if (typeof res !== 'string') {
|
||||||
// read further error msg
|
// read further error msg
|
||||||
throw new Error(res.Message)
|
throw new Error(res.Message)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue