Skip to content

Commit

Permalink
Release support - examples update (#471)
Browse files Browse the repository at this point in the history
Updated examples of digital identity and idv flows to surface and display the errors raised during identity profile checks.
  • Loading branch information
laurent-yoti committed May 15, 2024
1 parent 476b223 commit b6c1916
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/digital-identity/controllers/profile.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,13 @@ module.exports = async (req, res) => {
}

const receipt = await sdkDigitalIdentityClient.getShareReceipt(receiptId);

const receiptError = receipt.getError();
const receiptErrorReason = receipt.getErrorReason();
if (receiptError) {
throw new Error(`The receipt was fetched correctly, yet it indicates that an error occurred during the share: ${receiptError}.`);
throw new Error(receiptErrorReason
? `${receiptError}\nError reason: ${JSON.stringify(receiptErrorReason, null, 2)}`
: `${receiptError}`);
}

const profile = receipt.getProfile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@
<%= identityProfile.getResult(); %>
</td>
</tr>
<% if (identityProfile.getFailureReason()) { %>
<tr>
<td>Error details:</td>
<td>
<table class="table table-striped">
<tbody>
<tr>
<td style="width: auto">Error code</td>
<td><%= identityProfile.getFailureReason().getReasonCode(); %></td>
</tr>
<tr>
<td style="width: auto">Additional details</td>
<td><pre><%= JSON.stringify(identityProfile.getFailureReason().getRequirementsNotMetDetails(), null, 2); %></pre></td>
</tr>
</tbody>
</table>
</td>
</tr>
<% } %>
<% if (identityProfile.getIdentityProfileReport()) { %>>
<tr>
<td>Identity Profile Report</td>
<td>
Expand Down Expand Up @@ -43,5 +63,6 @@
</table>
</td>
</tr>
<% } %>
</tbody>
</table>

0 comments on commit b6c1916

Please sign in to comment.