I have a ServiceStack REST service and I need to implement custom error handling. I've been able to customize service errors by setting AppHostBase.ServiceExceptionHandler to a custom function.
However, for other types of errors, such as validation errors, this doesn't work. How can I cover all cases?
In other words, I'm trying to achieve two things:
- Set my own HTTP status codes for every kind of exception that might pop up, including non-service errors (validation)
- Return my own custom error object (not the default ResponseStatus) for every error type
How would I go about achieving this?