Skip to content

Commit 7e3dbd7

Browse files
authored
Release support - examples update (#471)
Updated examples of digital identity and idv flows to surface and display the errors raised during identity profile checks.
1 parent 7a50aaf commit 7e3dbd7

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

examples/digital-identity/controllers/profile.controller.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,13 @@ module.exports = async (req, res) => {
263263
}
264264

265265
const receipt = await sdkDigitalIdentityClient.getShareReceipt(receiptId);
266+
266267
const receiptError = receipt.getError();
268+
const receiptErrorReason = receipt.getErrorReason();
267269
if (receiptError) {
268-
throw new Error(`The receipt was fetched correctly, yet it indicates that an error occurred during the share: ${receiptError}.`);
270+
throw new Error(receiptErrorReason
271+
? `${receiptError}\nError reason: ${JSON.stringify(receiptErrorReason, null, 2)}`
272+
: `${receiptError}`);
269273
}
270274

271275
const profile = receipt.getProfile();

examples/idv-identity-checks/views/pages/partials/identity-profile.ejs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,26 @@
1212
<%= identityProfile.getResult(); %>
1313
</td>
1414
</tr>
15+
<% if (identityProfile.getFailureReason()) { %>
16+
<tr>
17+
<td>Error details:</td>
18+
<td>
19+
<table class="table table-striped">
20+
<tbody>
21+
<tr>
22+
<td style="width: auto">Error code</td>
23+
<td><%= identityProfile.getFailureReason().getReasonCode(); %></td>
24+
</tr>
25+
<tr>
26+
<td style="width: auto">Additional details</td>
27+
<td><pre><%= JSON.stringify(identityProfile.getFailureReason().getRequirementsNotMetDetails(), null, 2); %></pre></td>
28+
</tr>
29+
</tbody>
30+
</table>
31+
</td>
32+
</tr>
33+
<% } %>
34+
<% if (identityProfile.getIdentityProfileReport()) { %>>
1535
<tr>
1636
<td>Identity Profile Report</td>
1737
<td>
@@ -43,5 +63,6 @@
4363
</table>
4464
</td>
4565
</tr>
66+
<% } %>
4667
</tbody>
4768
</table>

0 commit comments

Comments
 (0)