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"
Don't catch your exception. Instead of that simply try:
throw "Some error happened";
/ Constantine