Catch an error if an addon provider is not found for a url

This commit is contained in:
john liddell
2020-11-28 10:50:57 -06:00
parent 98b7f13167
commit 2cd0b4f8ff
2 changed files with 6 additions and 4 deletions

View File

@@ -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");
}

View File

@@ -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<AddonSearchResult | undefined> {
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