samdenty/console-feed

Inside promise, errors are not being displaying in the console

isaacking5 opened this issue · 1 comments

Description

When I am trying to see the error logs which occur in promise, but in console-feed no errors are being displayed though
those errors appear in a browser console. But the with the same code which is outside the promise those errors are displaying in console-feed console.

code without promise

console.log("test".includ('test'))

above code WORKING AS EXPECTED, but

code inside the promise

new Promise((resolve) => {
  resolve();
}).then(() => stringIncludesTest());

function stringIncludesTest() {
  let dummyString = "test";
  console.log(dummyString.incldes("st"));
}

EXPECTED
Error should be display as :- ""a.incldes is not a function""

ACTUAL
Nothing is in console

NOTE : Browser console showing appropriate errors

One possible workaround is to capture the event generated by the unhandledrejcetion and manually log the error. Example:

window.addEventListener('unhandledrejection', (e: any) => {
  console.error(e.reason);
});