From fc6123091fc76b7c0855fa56e5ad168a82767c6b Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 10 Jan 2025 11:27:10 -0300 Subject: [PATCH] better error handler for credential offer issues --- packages/core/src/credentials/oidvc.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/src/credentials/oidvc.ts b/packages/core/src/credentials/oidvc.ts index be629a1f..457304d1 100644 --- a/packages/core/src/credentials/oidvc.ts +++ b/packages/core/src/credentials/oidvc.ts @@ -23,6 +23,10 @@ export async function acquireOpenIDCredentialFromURI({ holderKeyDocument, }); + if (!response) { + throw new Error('Unable to acquire credential. Please check your credential offer and try again.'); + } + if (response.authorizationURL) { const authorizationCode = await getAuthCode(response.authorizationURL); response = await credentialServiceRPC.acquireOIDCredential({