Added more useful error messages to REST API.