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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Writing Custom Thingworx Service 400 - 500 Level Error Return Code

AD_10324110
2-Explorer

Writing Custom Thingworx Service 400 - 500 Level Error Return Code

I want to do something like this - 

try{

if(someError)

   throw someErrorException()

}catch someErrorException{

result.message  = "someError happened"

}

 

Expected output in postman if the someError condition is true -

Status Code = 500 & response message = someError happened"

 

Instead of this, I am able to get it into status code 500 by forcefully writing erroneous code within the if statement but I am not able to set the error message. Its the standard error message which comes - "XYZ check scriptLog"

 

1 REPLY 1

Don't catch your exception. Instead of that simply try:

throw "Some error happened";

 / Constantine

Announcements


Top Tags