The question says it all. I am dealing with a complex RESTful Web Service and I’d like to return response with more information than just 400-something or 500-something. I need to add a reason why the request failed.
How would you accomplish this with WCF 4.0?
Thanks!
The typical approach is to return a specific code along with a response body that contains human-readable information describing the error in more detail.
One technique for this in WCF is to throw this form of WebFaultException which allows you to specify both a response body detail and a status code as constructor parameters.