I have a window.onerror defined in my project global Also I have a method throwing an error I am trying to catch the error in try catch block but from some reason it's not stop at the catch clause
window.onerror = (...) => {...}
const throwError = () => {throw new Error("")}
try { throwError() } catch (e) { ... }
As Bergbi said -
My crystal ball says that you're throwing the error in an asynchronous callback. Yes, the problem is deeper than the snippet you posted here, please edit your question to include code that actually reproduces the unexpected behaviour. – Bergi Feb 15 at 12:16
And He was right that was the problem - I was able to walk around that by changing the async callback