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

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation 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"

 

2 REPLIES 2

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

throw "Some error happened";

 / Constantine


Vilia (my company) | GitHub | LinkedIn

Hi @AD_10324110 
 

I wanted to follow up with you on your post to see if your question has been answered.
If so, please mark the appropriate reply as the Accepted Solution for the benefit of other members who may have the same question.
Of course, if you have more to share on your issue, please let the Community know so that we can continue to support.
 

Thanks,
Wenjing

Announcements


Top Tags