Account


Earned badges

Achievement: Latest Unlocked

Topic Started

Topics
The following code does not return the specific error message.
The following code does not return the specific error message.

Replies Created

Reply to: List of Error codes, Error Messages, Error Name

0 votes
How does the .NET SDK translate these errors? I mean, I tried to connect using a bad URL on purpose in the SDK, and am getting one of the errors below. How do I get the specific error code/reason it failed from the SDK when using a try...catch in C#? I mean, in the SDK, I have no idea what the "root cause" is, only that an error with a set of strings was thrown. Is there a special way to get this list from the SDK (Version 11.0.1.0 of the Silanis.ESL.dll)?
 try
            {
                PackageId packageId = eslClient.CreatePackage(documentPackage);
            }
            catch (Silanis.ESL.SDK.ServerError ex)
            {
                //What caused the error?
            }
Error returned as a string: 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) --- End of inner exception stack trace --- at Silanis.ESL.SDK.Services.PackageService.CreatePackage(Package package) at Silanis.ESL.SDK.EslClient.CreatePackage(DocumentPackage package) OR this one: 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="" sba.esign.esignprovider.getapplicationversion="" in="" c:="" sba.portalui.areas.systemadministration.controllers.diagnosticscontroller.esigntests="" lambda_method="" controllerbase="" object="" system.web.mvc.actionmethoddispatcher.execute="" controller="" parameters="" system.web.mvc.reflectedactiondescriptor.execute="" controllercontext="" idictionary="" system.web.mvc.controlleractioninvoker.invokeactionmethod="" actiondescriptor="" system.web.mvc.async.asynccontrolleractioninvoker.="">b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.c__DisplayClass46.b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.c__DisplayClass46.b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.c__DisplayClass46.b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.c__DisplayClass46.b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass33.b__32(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass21.c__DisplayClass2b.b__1c() at System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass21.b__1e(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) at System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Controller.b__15(IAsyncResult asyncResult, Controller controller) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Reply to: List of Error codes, Error Messages, Error Name

0 votes
Thank you for the offer to review the code, however we threw the errors on purpose to see if we can cleanly trap for each type and take the appropriate action.
For the second error you’re receiving, based on that it’s with Newtonsoft, it would appear to be an issue with the resulting structure of the JSON payload.
Yes, of course - but that is the connection we tried to make through the SDK, not Newtonsoft directly. In other words, the SDK called Newtonsoft in whatever the SDK used to connect, or when the error was returned from the connection. If we are getting "could not parse HTML" errors from Newtonsoft whenever a connectivity error occurs (remember, we triggered this with a bad URL on purpose), we can't be certain that it was actually a connectivity error when we are in Production mode. 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'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: List of Error codes, Error Messages, Error Name

0 votes
Herein lies the rub:
Though, if it’s a connectivity issue, they would get an exception like UnknownHostException or something.
We explicitly tried to make it throw a "connection error" by providing a bad URL. When we tried to create a package with this URL, the JSON error I provided was thrown. The code we used is this:
using Silanis.ESL.SDK;
using Silanis.ESL.SDK.Builder;
using System;
using System.Collections.Generic;
using System.IO;

    public class ESignProvider
    {
        private EslClient eslClient = null;
        private ESignProviderPackageDefiner definer = new ESignProviderPackageDefiner();
        private string apiKey = string.Empty;
        public string BaseUrl {
            get { return eslClient.BaseUrl; }
        }

        public ESignProvider(string apiKey, string baseUrl)
        {
            eslClient = new EslClient(apiKey, baseUrl);
            this.apiKey = apiKey;
        }
        public string CreatePackage(string packageName, DateTime expiryDate, string senderEmail, HandOverLinkBE handOverLink, LogoImageBE logoImage, string[] optOutReasons)
        {
            Silanis.ESL.SDK.DocumentPackage documentPackage = definer.DefinePackage(packageName, expiryDate, senderEmail, handOverLink, logoImage, optOutReasons).Build();
            Silanis.ESL.SDK.PackageId packageId = eslClient.CreatePackage(documentPackage);

            return packageId.ToString();
        }
    }

    public class HandOverLinkBE
    {
        public string Url { get; set; } = string.Empty;
        public string Text { get; set; } = string.Empty;
        public string ToolTip { get; set; } = string.Empty;

        public HandOverLinkBE(string url, string text)
        {
            Url = url;
            Text = ToolTip = text;
        }
    }

    public class LogoImageBE
    {
        public string Link { get; set; } = string.Empty;
        public string Source { get; set; } = string.Empty;

        public LogoImageBE(string logoImageLink)
        {
            Link = Source = logoImageLink;
        }
    }

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.

Subscriptions

Topics Replies Freshness Views Users
The following code does not return the specific error message.
3 6 years 2 months ago 87
Profile picture for user harishaidary
The following code does not return the specific error message.
2 7 years ago 148
Profile picture for user harishaidary
Hi, I have noticed that there are a bunch of different error messages under the EslServerException. Where can I find a list of all these error messages with their corresponding error codes and error n
15 7 years 1 month ago 2,806
Profile picture for user mwilliams

Code Share

This user has not submitted any code shares.

Subscriptions Release Notes

This user is not subscribed to any release notes.