fix: packages and unnecessary if statement
This commit is contained in:
parent
3260672412
commit
6a6e2a5ea1
4 changed files with 7772 additions and 5253 deletions
13016
dist/main.js
vendored
13016
dist/main.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -88,7 +88,7 @@ void (async () => {
|
|||
if (!confirmed) return
|
||||
|
||||
// initiate LibreScore link request
|
||||
librescoreLink = getLibreScoreLink(scoreinfo)
|
||||
librescoreLink = getLibreScoreLink(scoreinfo, true)
|
||||
|
||||
// print a blank line to the terminal
|
||||
console.log()
|
||||
|
@ -133,6 +133,7 @@ void (async () => {
|
|||
spinner.info('Score loaded by webmscore')
|
||||
} catch (err) {
|
||||
spinner.fail(err.message)
|
||||
spinner.info('Send your URL to the #dataset-bugs channel in the LibreScore Community Discord server');
|
||||
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, _fetch = getFetch()): Promise<string> => {
|
||||
export const getLibreScoreLink = async (scoreinfo: ScoreInfo, isMsdl: Boolean, _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, _fetch = getFetch(
|
|||
assertRes(r0)
|
||||
}
|
||||
const res: { Message: string } | string = await r0.json()
|
||||
if (typeof res !== 'string') {
|
||||
if (typeof res !== 'string' && !isMsdl) {
|
||||
// read further error msg
|
||||
throw new Error(res.Message)
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export const loadMsczUrl = async (scoreinfo: ScoreInfo, _fetch = getFetch()): Pr
|
|||
// read further error msg
|
||||
const err = cidRes.Message
|
||||
if (err.includes('no link named')) { // file not found
|
||||
throw new Error('score not in dataset')
|
||||
throw new Error('Score not in dataset')
|
||||
} else {
|
||||
throw new Error(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue