Skip to content

Commit

Permalink
refactor: Adjust some error handling/reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Nov 1, 2024
1 parent 404220d commit a6c853a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions xmcl-runtime/user/accountSystems/YggdrasilAccountSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export class YggdrasilAccountSystem implements UserAccountSystem {
} else if (e.error === 'ForbiddenOperationException' &&
e.errorMessage === 'Invalid credential information.') {
throw new UserException({ type: 'loginInvalidCredentials' }, e.message || e.errorMessage, { cause: e })
} else if (e.error === 'ForbiddenOperationException') {
throw new UserException({ type: 'loginGeneral' }, e.message || e.errorMessage, { cause: e })
} else if (e.error === 'IllegalArgumentException') {
throw new UserException({ type: 'loginInvalidCredentials' }, e.message || e.errorMessage, { cause: e })
} else if (isSystemError(e)) {
Expand Down
5 changes: 4 additions & 1 deletion xmcl-runtime/version/VersionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ export class VersionService extends StatefulService<LocalVersions> implements IV
const hashIndexPath = this.getPath('assets', 'indexes', `${version.assetIndex.sha1}.json`)
missing(hashIndexPath).then(isMissing => {
if (isMissing) {
return linkOrCopyFile(assetIndexPath, hashIndexPath)
return linkOrCopyFile(assetIndexPath, hashIndexPath).catch((e) => {
this.warn(`Failed to link asset index ${version.assetIndex?.id} to ${version.assetIndex?.sha1}.json`)
this.warn(e)
})
}
})
}
Expand Down

0 comments on commit a6c853a

Please sign in to comment.