From 2cd0b4f8ffa86dc4a70418754f4479e731055fe7 Mon Sep 17 00:00:00 2001 From: john liddell Date: Sat, 28 Nov 2020 10:50:57 -0600 Subject: [PATCH] Catch an error if an addon provider is not found for a url --- .../install-from-url-dialog.component.ts | 2 -- wowup-electron/src/app/services/addons/addon.service.ts | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wowup-electron/src/app/components/install-from-url-dialog/install-from-url-dialog.component.ts b/wowup-electron/src/app/components/install-from-url-dialog/install-from-url-dialog.component.ts index 213259a8..22cb9be7 100644 --- a/wowup-electron/src/app/components/install-from-url-dialog/install-from-url-dialog.component.ts +++ b/wowup-electron/src/app/components/install-from-url-dialog/install-from-url-dialog.component.ts @@ -97,8 +97,6 @@ export class InstallFromUrlDialogComponent implements OnInit, OnDestroy { try { const importedAddon = await this._addonService.getAddonByUrl(url, this._sessionService.selectedClientType); - - console.debug(importedAddon); if (!importedAddon) { throw new Error("Addon not found"); } diff --git a/wowup-electron/src/app/services/addons/addon.service.ts b/wowup-electron/src/app/services/addons/addon.service.ts index 33495665..b599bd9f 100644 --- a/wowup-electron/src/app/services/addons/addon.service.ts +++ b/wowup-electron/src/app/services/addons/addon.service.ts @@ -517,8 +517,12 @@ export class AddonService { return this._addonStorage.get(addonId); } - public async getAddonByUrl(url: URL, clientType: WowClientType) { + public async getAddonByUrl(url: URL, clientType: WowClientType): Promise { const provider = this.getAddonProvider(url); + if (!provider) { + console.warn(`No provider found for urlL: ${url}`); + return undefined; + } return await provider.searchByUrl(url, clientType); } @@ -766,7 +770,7 @@ export class AddonService { addon.externalIds = externalIds; } - private reconcileUnmatchedAddons(addon: Addon) {} + private reconcileUnmatchedAddons(addon: Addon) { } /** * This should verify that a folder that did not have a match, is actually unmatched