Skip to main content
Nov 24, 2020 1:46 AM UTC
Question

Writing Custom Thingworx Service 400 - 500 Level Error Return Codes

Is it possible to write a Thingworx service in Javascript to return custom 400 - 500 level error codes for when the service is being called via REST?  Or does REST calls to a custom Thingworx service only return the standard defined set of response codes, including error codes?

7 replies

Nov 25, 2020 6:57 AM UTC

Hi @SG_9149098 ,

 

In ThingWorx javascript service you can write your try/catch block and write your custom logs entries as per wish .. but the type of error/exception thrown would generally follow standard rules of JS.
 
Note : If my response has answered your question, please mark as Accepted Solution, for the benefit of others who may have the same question.
Nov 30, 2020 7:25 PM UTC

Thanks for the response anarwal.  Do you happen to have an example of returning 400 or 500 level error codes in Thingworx javascript?  It seems javascript functionality in Thingworx is a little more restricted versus some of the javascript functionality available outside of Thingworx.

Jan 5, 2021 9:19 PM UTC

Hi @SG_9149098.

 

If you feel your question has been answered (even if it was not the answer you wanted), please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Jan 14, 2021 4:48 PM UTC

Hi @SG_9149098.

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon