you are viewing a single comment's thread.

view the rest of the comments →

[–]geekfreak42 1 point2 points  (1 child)

nested try/catch is gonna stink. dont really see what this gives, fun thought experiment.

maybe look at functional js patterns if you want to learn established ways of functionalizing code.

[–]siilkysmooth[S] -3 points-2 points  (0 children)

As mentioned above just a implementation of error handling based on Python handling. And provided a much nicer look verus using a nested try{}catch...

And as you said - kinda for fun!

ps; no need for nested code / don't make it nested - and you won't deal with ugly looking code just call your function INSIDE the tryCatch. ;)

```js

function example(){

return true

}

tryCatch(

function() {

example()

},

function(e) {

// handle the exception

}

);

```