TroyMunford

SDK does not expose error mesages

0 votes
The following code does not return the specific error message.
 try
            {
                PackageId packageId = eslClient.CreatePackage(documentPackage);
            }
            catch (Silanis.ESL.SDK.ServerError ex)
            {
                //What caused the error?
            }
 
Is there a special way to get the actual error code from the SDK (Version 11.0.1.0 of the Silanis.ESL.dll) without rewriting the SDK to expose real errors and codes (like it does for the java SDK)? Using the above code, we included a bad connection string (to a non-existent URL) on purpose, and are getting error message like the following when using the SDK: Error returned as a string: Silanis.ESL.SDK.EslException: Could not get application version. Exception: Unexpected character encountered while parsing value: <. path="" line="" position=""> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. path="" line="" position="" at="" newtonsoft.json.jsontextreader.parsevalue="" newtonsoft.json.jsontextreader.readinternal="" newtonsoft.json.jsontextreader.read="" newtonsoft.json.serialization.jsonserializerinternalreader.readfortype="" reader="" jsoncontract="" contract="" boolean="" hasconverter="" newtonsoft.json.serialization.jsonserializerinternalreader.deserialize="" type="" objecttype="" checkadditionalcontent="" newtonsoft.json.jsonserializer.deserializeinternal="" newtonsoft.json.jsonconvert.deserializeobject="" value="" jsonserializersettings="" settings="" silanis.esl.sdk.systemservice.getapplicationversion="" end="" of="" inner="" exception="" stack="" trace="" why="" the="" real="" error="" is="" important:="" a="" connectivity="" might="" mean="" we="" take="" action="" to="" notify="" operations="" group="" ensure="" up.="" user="" account="" tell="" us="" owner="" have="" on="" record="" action.="" i="" can="" you="" that="" final="" response="" got="" from="" r="" following="" forum="" thread="" incorrect="" above="" message="" when="" using="" client="" sdk.="" href="https://developer.esignlive.com/forums/topic/list-of-error-codes-error-messages-error-name/" target="_blank">https://developer.esignlive.com/forums/topic/list-of-error-codes-error-messages-error-name/ I’m looking forward to determining how the real errors can be found, without everyone who uses the SDK needing to rewrite it to get those real error codes.

Reply to: SDK does not expose error mesages

0 votes
Hi Troy, Did you have a look at this to see if it helps you get what you're looking for: http://docs.esignlive.com/content/c_integrator_s_guide/sdk/i_reports_and_logging/exception_handling.htm?Highlight=error If not, you can make a request by posting about this in the Enhancement Ideas forum. Our product managers monitor this forum for ideas for new features from customers/prospects.
Haris Haidary OneSpan Technical Consultant

Reply to: SDK does not expose error mesages

0 votes
Yes, tried that. Here's what we get when calling the eslClient.SystemService.GetApplicationVersion() with a bad URL:
Silanis.ESL.SDK.EslException: Could not get application version. Exception: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Silanis.ESL.SDK.Internal.HttpMethods.GetHttpJson(String apiToken, String path, String acceptType)
   at Silanis.ESL.SDK.RestClient.Get(String path)
   at Silanis.ESL.SDK.SystemService.GetApplicationVersion()
Same result for eslClient.AccountService.GetSenders() with a bad URL:
Silanis.ESL.SDK.EslException: Failed to retrieve Account Members List.	 Exception: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Silanis.ESL.SDK.Internal.HttpMethods.GetHttpJson(String apiToken, String path, String acceptType)
   at Silanis.ESL.SDK.RestClient.Get(String path)
   at Silanis.ESL.SDK.AccountApiClient.GetSenders(Direction direction, PageRequest request)
Finally, the result using eSignProvider.CreatePackage() with a bad URL:
Silanis.ESL.SDK.EslException: Could not create a new package. Exception: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Silanis.ESL.SDK.Internal.HttpMethods.PostHttp(String apiToken, String path, Byte[] content)
   at Silanis.ESL.SDK.RestClient.Post(String path, String jsonPayload)
   at Silanis.ESL.SDK.Services.PackageService.CreatePackage(Package package)
These are not nearly extensive enough. I mean, I know it couldn't but don't have any WHY other than a Null reference exception. The only way to attempt to get the error is to parse the first "at..." line. Even for this one, I cannot assume the URL was bad. Could have been any of a multitude of HTTP errors like 400, 403, 404, 407, 408, etc. Even more, I want to know if my firewall refuses the connection such as "Connection refused". The full error might even show the IP address we tried to connect to with our bad URL (maybe the URL is good, but the firewall isn't open to connect to that particular IP address). All I'm saying is that the SDK is suppressing the real/full error in lieu of a more wordy error message. I will post the suggestion to return the full error messages in the forum you recommend.

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off