TroyMunford | Posts: 6

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 1, position 1. —> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: . Path ”, line 1, position 1. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Silanis.ESL.SDK.SystemService.GetApplicationVersion() — End of inner exception stack trace — at Silanis.ESL.SDK.SystemService.GetApplicationVersion() Why the real error is important: - A connectivity error might mean we take action to notify the Operations group to ensure connectivity is up. - A user account error might tell us to notify the account owner we have on record to take action. I can tell you that the final response that "MWilliams" got from R&D on the following forum thread is incorrect (see above error message) when using the client SDK. 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.

harishaidary | Posts: 1812

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.

TroyMunford | Posts: 6

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