Currently, when I (or, more importantly, a user) in one of my leisure functions in a URL, it works with a status code of 200. But if you enter the wrong code or use it incorrectly, a 404 page is created with the status code 404 when viewed through a REST client.
Instead of sending 404 pages when sending a bad URL, I would like to display a dynamically generated JSON object instead.
How to fix this error handling to do what I want, is there a place where I can determine what should be done during a specific status code?
source share