Skip to content

Commit

Permalink
refactor: Log the malform resource during install
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Jun 4, 2023
1 parent 7eeee2e commit 69923c0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions xmcl-runtime/lib/services/InstanceInstallService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,14 @@ export class InstanceInstallService extends AbstractService implements IInstance

if (resource) {
if ((metadata.modrinth && !resource.metadata.modrinth) || (metadata.curseforge && resource.metadata.curseforge) || (urls.length > 0 && urls.some(u => resource.uris.indexOf(u) === -1))) {
await this.resourceService.updateResources([{ hash: resource.hash, metadata, uris: urls }]).catch((e) => {
this.warn(`Fail to update existed resource ${resource.name}(${resource.hash}) metadata during instance install:`)
this.warn(e)
})
if (!resource.hash) {
this.error(new TypeError('Invalid resource ' + JSON.stringify(resource)))
} else {
await this.resourceService.updateResources([{ hash: resource.hash, metadata, uris: urls }]).catch((e) => {
this.warn(`Fail to update existed resource ${resource.name}(${resource.hash}) metadata during instance install:`)
this.warn(e)
})
}
}
return createFileLinkTask(filePath, resource)
}
Expand Down

0 comments on commit 69923c0

Please sign in to comment.