Tagged: , , ,

This topic contains 3 replies, has 4 voices, and was last updated by  poggialb 1 year, 2 months ago.

  • Author
    Posts
  • Participant
    TroyMunford
    Newbie
    Member since: 07.10.2016
    Number of posts: 6

    The 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

    Participant
    benjamin.holley
    Newbie
    Member since: 30.05.2016
    Number of posts: 1

    Score

    0

    I emphatically agree with this enhancement. When these null reference exceptions show up in an environment, the operations teams always end up going back to developers for root cause analysis.

    However, if the ESL SDK correctly returned the error ‘Could not connect to server https://abc.com/api’, the operations team could immediately begin triaging networking issues and get the environment up and running without having to round up staff from every team.

    Keymaster
    Haris
    Jedi Master
    Member since: 05.11.2015
    Number of posts: 1450

    Score

    0

    Hi there,

    This particular enhancement request has been accepted for roadmap consideration. Note that this doesn’t necessarily guarantee that the enhancement will be added to the roadmap. Requests are reviewed by a committee on a quarterly basis to determine which candidates can be slotted into the roadmap.


    Haris Haidary
    OneSpan Technical Consultant
    Participant
    poggialb
    Newbie
    Member since: 22.02.2017
    Number of posts: 7

    Score

    0

    Plus 1 for this enhancement

You must be logged in to reply to this topic.