DEV Community

loading...
Cover image for When try...catch dosen't work

When try...catch dosen't work

ashrafulislam profile image Ashraful Islam ・1 min read

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:

Discussion (0)

Forem Open with the Forem app