react-error-overlay throwing errors caught through try catch block
Hi
I am using react version 16.x.x. I have added a try catch block. When my try throws an error, the catch block executes. But after that react-error-overlay throws the error that was caught and breaks the app.
Sample code: try{ initCommon(); fin.desktop.main(function() { console.log('fin available'); }); }catch(err){ console.log('fin not available'); }
Here I get the message 'fin not available' in console. But after that I get this error:
error 'fin' is not defined no-undef
Please let me know why react-error-overlay is causing this.
Can you provide a complete example? It’s not very clear to me what you’re asking. Screenshots would also help.
Hi Gaearon,
Please find the screenshot:

Its a try catch block. Ideally, the exception should be thrown to catch and the app should work. But after the catch gets the exception, the error forces the app to halt.

Attached: console showing the the catch block executes:

Okay, so the problem here is not the exception, but a strict lint check.
We ask that if you must intend to use a global variable, you should prefix it with window. to make the intent clear. This helps discover typos.
If you replace qwerty with window.qwerty your example will compile.