I followed this link 'https://docs.feathersjs.com/services/readme.html' to create a restful service by feathersjs. It works fine for normal case. But I don't know how to response an error message to client, like 404, 500, etc. Below is the service code. It returns response via promise.resolve. How to return an error in this case?
class MessageService {
get(id, params) {
return Promise.resolve({
id,
read: false,
text: `Feathers is great!`,
createdAt: new Date.getTime()
});
}
}
You can use
'feathers-errors'
module to set the error codes. Please see the sample code below.feathers-errors module