Add full error messages to the .NET SDK
Monday, March 13, 2017 at 09:39amThe following code does not return the specific error message.
try { PackageId packageId = eslClient.CreatePackage(documentPackage); } catch (EslServerException serverException) { Console.Out.WriteLine( "The server could not complete the request." ); Console.Out.WriteLine( serverException.Message ); Console.Out.WriteLine( "HTTP code: " + serverException.ServerError.Code); Console.Out.WriteLine( "Server message: " + serverException.ServerError.Message); } catch (EslException exception) { Console.Out.WriteLine( exception.Message ); Console.Out.WriteLine( exception.InnerException.Message ); }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: NOTE: Connection string errors are only throwing a EslException,and never a EslServerException.
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()OR 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()OR when calling the 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)OR when calling the 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)I know it couldn't create the package because that's where my caller got the error. I'm far more interested in WHY it couldn't create the package (other than "something was null"). Please provide a way to get the actual errors, codes, etc., in the SDK (Version 11.0.1.0 of the Silanis.ESL.dll). Original post for assistance in the forums: https://developer.esignlive.com/forums/topic/sdk-does-not-expose-error-mesages/#post-5776
Reply to: Add full error messages to the .NET SDK
Monday, July 31, 2017 at 06:35amReply to: Add full error messages to the .NET SDK
Monday, July 31, 2017 at 10:51amReply to: Add full error messages to the .NET SDK
Thursday, January 18, 2018 at 12:52pm