canned icon indicating copy to clipboard operation
canned copied to clipboard

Default error message

Open runemadsen opened this issue 12 years ago • 1 comments

Most API's have a default error message like this:

{"message":"404 Not found"}

It would be awesome if we could create a 404.json or something, and have a default error response from canned. Any thoughts on name and other functionality? I might take a stab at this soon.

runemadsen avatar Dec 12 '13 14:12 runemadsen

Sounds good, I would follow you approach of using 'special' files like 404.json for this. Wondering if there is a way to support multiple formats like xml, html, and json. Probably the best is going for a detection via the Accept header and if this fails try to match a content type from the request URL since there are enough cases where setting the content type is done via adding .json to the URL (looking at you rails ;) ).

They fallback should be HTML still I think. So maybe we can even include something helpful by default then if not overwritten by the user.

sideshowcoder avatar Dec 12 '13 14:12 sideshowcoder