dashersw / cote

A Node.js library for building zero-configuration microservices.

Home Page:http://cote.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What about error handling?

dreambit opened this issue · comments

Hi, i did not find any docs on error handling

timeService.on('time', (req, cb) => {
// some error
// how to return error
cb(new Error());
});

If you are using callbacks, you can use any convention for errors (usually, first argument in responses becomes error, and the way you did it is right) and if you are using promises / async await, throwing errors just works.