cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Exception thrown from the server code is not received in the C# client. But a generic exception is thrown

Highlighted
Level 1

Exception thrown from the server code is not received in the C# client. But a generic exception is thrown

Hi All,

I created a service in the TWX server which does a particular action.

The service code will throw some exception during some failure scenarios. Code which throw the exception is below:

if()

{

do something

}

else {

    throw ("A device with ID already exists.");

}

Then i wrote a client application using TWX Edge .NET SDK v5.6.5.

This application will connect to the server and calls the service. My expectation was that if service code throws above exception, i would get exception string in the client, so that i can take some decisions.

In positive scenarios, everything is working fine.

But during the failure scenarios (i.e. exception thrown from the service code in server), i am getting a entirely different exception in the client application.

Exception details are below:

"TwApiException was caught"

"Error invoking Service for Entity. Internal Server Error. (Code 1110)"

Any idea on why i am not getting the exception that is thrown from the server??/

Thanks in advance.

Tags (2)
2 REPLIES 2

Re: Exception thrown from the server code is not received in the C# client. But a generic exception is thrown

Tobin, in which log are you seeing this? What client is this which are you referring to? Was the service created within the .NET SDK and do you see this exception when that service fails to execute correctly when called within the ThingWorx composer? or was the service created directly in ThingWorx Composer ?

Re: Exception thrown from the server code is not received in the C# client. But a generic exception is thrown

Sushant,

Thanks for the response.

- Service was created directly in the ThingWorx Composer.

- Exception is observed in the client application which communicate with TWX server and invoke this service.

- Client application is something similar to SteamSensor application.

- Client application is written in C# .NET.

More information:

Below api in the 'BaseClient' class is used for invoking the service from the client application:

public InfoTable invokeService(RelationshipTypes.ThingworxEntityTypes entityType, string entityName, string service, ValueCollection parameters, int timeout);