My question is around error handling with a RESTful API. Traditionally people have used error codes and messages in the response body. My question is can you formulate those errors into full fledged resources. For example you might want to get the error as an HTML page or get a list of possible errors in json format. It seems quite natural for an error to be a resource.
However it seems a bit dirty to return a "resource" as an error for another resource but if you think about it an error code and an error message in the request body is just that without the extra useful semantics of a resource.
Also to be clear this shouldn't be a subjective question. I want to know if doing this would violate RESTful design principles or any notable relevant RFC for HTTP communication.
Edit:
One issue is the need to differentiate between error types and error instances. It pretty useful to have error types as resources but capturing every possible error instance and reporting that back isn't as useful.
Edit2:
The core of the question is if an error resource (different resource than requested) should be put in the 4XX/5XX response body. The question about if 200 + error or 4XX/5XX should handle errors is answered over here:REST API error return good practices