Error not being output within promise
See original GitHub issueI have a scenario where I have a catch all for any error I cannot handle and it looks like so:
.catch(function(error){
console.error(error);
logger.error("Could not do something", {error: error});
res.status(500).end();
});
Now the problem I had originally was my console log would not output the error, it would just show an empty error object, however if I do console.error(error);
it outputs the actual error, so there is an error there. So is there any reason why the error would not be output by winston but is by regular console.error.
If it helps the error is: [ReferenceError: repository is not defined]
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Why can I not throw inside a Promise.catch handler?
In your case, you are rejecting inside do1 by throwing an Error object. Now, the current promise will be in rejected state and...
Read more >Promise.prototype.catch() - JavaScript - MDN Web Docs
The catch() method of a Promise object schedules a function to be called when the promise is rejected. It immediately returns an equivalent ......
Read more >Promise Error Handling - JavaScript Tutorial
In this tutorial, you will learn about promise error handling that shows you how to handle error in promises.
Read more >Promises - Error Handling - Beginner JavaScript - Wes Bos
It means that there was an error in one of our promises, but we did not write any code in order to handle...
Read more >JavaScript Promises – The promise.then, promise.catch and ...
A promise is an object in JavaScript that will produce a value sometime ... does not work so I catch the error so...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be resolved in
winston@3.0.0-rc4
. Please consider upgrading. Thank you for usingwinston
!If anyone was curious into fixing this I was able to figure out how to echo out errors using Winston’s filters setting