Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Try/Catch in function.attempt prevents errors from showing up in console #2445

Closed
hobberwickey opened this Issue · 1 comment

2 participants

@hobberwickey

I'm not sure if it's an error, but it certainly caused me a lot of headaches.

Function.attempt is wrapped with a try/catch block that prevents errors from showing up. It doesn't seem to be serving any other purpose that I can see beside hiding errors which doesn't seem correct to me.

To see the problem consider this function

function foo(){
var test = value.x
}

if you call the function via attempt like

(function(){
foo.attempt();
})()

You'll receive no error message instead the application will fail silently and the developer is forced to track down the error with nothing to go on. This may not be a bug, but it's definitely not optimal.

@cpojer
Owner

I'm not entirely sure if you are trolling or not but the purpose, as the function name suggests, is to attempt executing the function and in case of an error to discard and ignore it. You either get a result or you don't. If you do want the error to show up, do not use this method. Easy.

@cpojer cpojer closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.