Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hobberwickey opened this issue Nov 16, 2012 · 1 comment
Closed

Comments

@hobberwickey
Copy link

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
Copy link
Member

cpojer commented Nov 16, 2012

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 as completed Nov 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants