Skip to content

Commit

Permalink
fix: Support Logger swallowing (#995)
Browse files Browse the repository at this point in the history
When you swallow an error you expect silence... this common built in hook makes it noisy regardless. It looks almost exactly like an uncaught error and is very deceiving

This results in handled errors looking like this:

```
info: error: mailer - Method: create: getaddrinfo ENOTFOUND smtp.mailgun.org 
```

Instead of this:
```
info: error: mailer - Method: create: getaddrinfo ENOTFOUND smtp.mailgun.org smtp.mailgun.org:2525
error:  Error: getaddrinfo ENOTFOUND smtp.mailgun.org smtp.mailgun.org:2525
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:50:26)
```
which I much prefer.

MOVED TO MONOREPO FROM: feathersjs-ecosystem/generator-feathers#392 (comment)
  • Loading branch information
Ray Foss authored and daffl committed Sep 17, 2018
1 parent a13929c commit 5b3b37e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function () {
logger.debug('Hook Context', util.inspect(context, {colors: false}));
}

if(context.error) {
if(context.error && !context.result) {
logger.error(context.error.stack);
}
};
Expand Down

0 comments on commit 5b3b37e

Please # to comment.