Skip to main content
5-Regular Member
November 24, 2020
Question

Writing Custom Thingworx Service 400 - 500 Level Error Return Codes

  • November 24, 2020
  • 2 replies
  • 2502 views

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?

2 replies

5-Regular Member
November 25, 2020

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.
5-Regular Member
November 30, 2020

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.

Support
January 5, 2021

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

Support
January 14, 2021

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