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

Error managment in services

Highlighted
Visitor

Error managment in services

Hi,

I have a service A on a thing which is calling a service B on a utilityThing.

This service B return an infotable

Some time, in internal process of B, we have an error which has to be propagate to A.

How to do that ?

I try with a javascript "throw" but it seems to be intercepted by plateform as in the try catch in A I see a JavaException.

Best regards

Stéphane

2 REPLIES 2
Highlighted

Re: Error managment in services

Could you please provide more details? I apologize for the misunderstanding, the description is not too clear. Does the error in B occur as a result of a service calling, i.e infotable is no longer returned? You may try catch in A around the service B, and then ensure your result is outside of that .

Highlighted

Re: Error managment in services

Hi Stephane,

You can use throw "text";  // -- I think it's not officially supported anyway, I've used in the past but I'm removing almost everywhere on my code

It works, but I recommend you to minimize the times on your programing blocks when a Exception occurs, as it's super slow to process. For instance if you Iterate over N-objects and you relay on a try{}catch inside the loop to catch errors if you have many of them it will be super slow to execute.

If you can, better you prevent calling B if you can know in advance that there will be an error ( param checking and alike ) and/or detect error on B and return a special case Infotable and not throwing an exception.

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!