diff --git a/packages/dapp/src/components/ShareCredentialModal/index.tsx b/packages/dapp/src/components/ShareCredentialModal/index.tsx index de986f338..071ba5649 100644 --- a/packages/dapp/src/components/ShareCredentialModal/index.tsx +++ b/packages/dapp/src/components/ShareCredentialModal/index.tsx @@ -155,8 +155,13 @@ export const ShareCredentialModal = () => { try { const result = await shareResponse.json(); - if (!result.presentationId) - throw new Error('Failed to share presentation'); + if (!result.presentationId) { + throw new Error( + result.message === 'Invalid presentation' + ? 'Invalid presentation' + : 'Failed to share presentation' + ); + } setShareLink( `${window.location.origin}/app/share-presentation/${result.presentationId}` @@ -165,7 +170,10 @@ export const ShareCredentialModal = () => { setTimeout(() => { useToastStore.setState({ open: true, - title: t('share-presentation-error'), + title: + (e as Error).message === 'Invalid presentation' + ? t('share-error-invalid') + : t('share-presentation-error'), type: 'error', loading: false, link: null, diff --git a/packages/dapp/src/messages/en.json b/packages/dapp/src/messages/en.json index 384131fc3..d1181c6f6 100644 --- a/packages/dapp/src/messages/en.json +++ b/packages/dapp/src/messages/en.json @@ -604,6 +604,7 @@ "placeholder": "Enter a title for the presentation. This can't be changed later.", "please-sign-in": "Please sign in to share your credentials", "selected": "Selected Credentials", + "share-error-invalid": "One or more credentials in the presentation are invalid.", "share-presentation-error": "Failed to share presentation", "share-presentation-success": "Successfully shared presentation", "share-link-description": "Share your credential:",