From f1aee049f86eb761e95fd86885b4b765fbfbf170 Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 23 Jan 2024 09:46:34 +0100 Subject: [PATCH] Could not fetch branding error --- .../credential/OpenId4VcIssuanceProvider.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/providers/credential/OpenId4VcIssuanceProvider.ts b/src/providers/credential/OpenId4VcIssuanceProvider.ts index d3d05176..25828731 100644 --- a/src/providers/credential/OpenId4VcIssuanceProvider.ts +++ b/src/providers/credential/OpenId4VcIssuanceProvider.ts @@ -324,16 +324,22 @@ class OpenId4VcIssuanceProvider { if (!this._issuerBranding) { this._issuerBranding = this._serverMetadata.credentialIssuerMetadata?.display; } - if (!this._credentialBranding) { this._credentialBranding = new Map>(); await Promise.all( this._credentialsSupported.map(async (metadata: CredentialSupported): Promise => { - const localeBranding: Array = await Promise.all( - (metadata.display ?? []).map( - async (display: CredentialsSupportedDisplay): Promise => - await ibCredentialLocaleBrandingFrom({localeBranding: await credentialLocaleBrandingFrom(display)}), - ), + const optionalLocaleBranding: Array = await Promise.all( + (metadata.display ?? []).map(async (display: CredentialsSupportedDisplay): Promise => { + try { + return await ibCredentialLocaleBrandingFrom({localeBranding: await credentialLocaleBrandingFrom(display)}); + } catch (e) { + console.error(`Could not fetch branding. Branding data: ${JSON.stringify(display)}`); + } + }), + ); + + const localeBranding: Array = optionalLocaleBranding.filter( + (branding): branding is IBasicCredentialLocaleBranding => branding !== undefined, ); const credentialTypes: Array =