Skip to content

Commit fe3fdc6

Browse files
committed
Adding error handling for example 16
1 parent 94a5a68 commit fe3fdc6

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

launcher-csharp/eSignature/Controllers/SetEnvelopeTabValue.cs

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace DocuSign.CodeExamples.Controllers
66
{
77
using DocuSign.CodeExamples.Common;
88
using DocuSign.CodeExamples.Models;
9+
using DocuSign.eSign.Client;
910
using Microsoft.AspNetCore.Mvc;
1011

1112
[Area("eSignature")]
@@ -54,20 +55,30 @@ public IActionResult Create(string signerEmail, string signerName)
5455
var accessToken = this.RequestItemsService.User.AccessToken; // Represents your {ACCESS_TOKEN}
5556
var accountId = this.RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID}
5657

57-
// Call the Examples API method to create an envelope and set the tab values
58-
(string envelopeId, string redirectUrl) = global::ESignature.Examples.SetEnvelopeTabValue.CreateEnvelopeAndUpdateTabData(
59-
signerEmail,
60-
signerName,
61-
this.signerClientId,
62-
accessToken,
63-
basePath,
64-
accountId,
65-
this.Config.TabsDocx,
66-
this.dsReturnUrl,
67-
this.dsPingUrl);
58+
try
59+
{
60+
// Call the Examples API method to create an envelope and set the tab values
61+
(string envelopeId, string redirectUrl) = global::ESignature.Examples.SetEnvelopeTabValue.CreateEnvelopeAndUpdateTabData(
62+
signerEmail,
63+
signerName,
64+
this.signerClientId,
65+
accessToken,
66+
basePath,
67+
accountId,
68+
this.Config.TabsDocx,
69+
this.dsReturnUrl,
70+
this.dsPingUrl);
6871

69-
this.RequestItemsService.EnvelopeId = envelopeId;
70-
return this.Redirect(redirectUrl);
72+
this.RequestItemsService.EnvelopeId = envelopeId;
73+
return this.Redirect(redirectUrl);
74+
}
75+
catch (ApiException apiException)
76+
{
77+
this.ViewBag.errorCode = apiException.ErrorCode;
78+
this.ViewBag.errorMessage = apiException.Message;
79+
80+
return this.View("Error");
81+
}
7182
}
7283
}
7384
}

0 commit comments

Comments
 (0)