DEV Community

Cover image for When try...catch dosen't work
Ashraful Islam
Ashraful Islam

Posted on

When try...catch dosen't work

try...catch only works for runtime errors
For try...catch to work, the code must be runnable. In other words, it should be valid JavaScript.

It won’t work if the code is syntactically wrong, for instance it has unmatched curly braces:

Top comments (0)