Thank you!
Every exception that it is not “controlled" will fall to the generic response before the check.
The response/exceptio handling can be tailored for your needs. For a more generic approach, you can create a generic controlled Exception, like an IControlledException, and make every custom exception you want to have a better response to your client inherit from it. The instead of a hardcoded check, you can check if the exceptio is of type IControlledException and refine your response there.
I also didn’t put in this article but you should log your exception before returning the response.