According to the image, it will first try the try block, if it finds an error, it will go to the catch block, passing an argument (error or err or even e) are the parameters most often used by developers, where it passes the error's StackTrace.
You can pass a different stacktrace, if you notice in the else statement there is a "throw new Error()"; this is the one that will be responsible for giving a custom stacktrace.
Anyway, I hope I clarified your questions about Try/Catch statements, and this is my first post here ;)
See you
Top comments (2)
Hello and congratulations on your first post.
I wrote an article on the same subject two weeks ago. Maybe you're interested.
Asynchronous JS: Working with try/catch and promises
DevLorenzo γ» Feb 12 γ» 2 min read
Yeah, I saw your article 'bout it a couple days ago, and I loved it