Problem Details for HTTP APIs and Nancy
There are a number of guidelines for returning errors from a REST API in a consistent way. Of course, API authors should use status codes correctly to signify the result of an action. It is also a good idea to return some error details in resource representation. Some API vendors, like Facebook or Twitter have come up with their own solutions.
However, there is a Internet Engineering Task Force (IETF) proposed standard called Problem Details for HTTP APIs. It was created be Mark Nottingham and is described in document RFC 7807. Interestingly though there is fairly little support in for .NET Web API libraries and none for Nancy 1.x.
Unfortunately there wasn’t one for the stable branch of Nancy, currently at 1.4.3.
And so, I have created my own package I called Nancy.ProblemDetails. It adds support for serializing JSON Problem Details and uses the library Tavis.Problem by Darrel Miller.
Do have a look at the repository for usage examples: https://github.com/tpluscode/Nancy.ProblemDetails