Skip to content

Exceptions silently swallowed in $(fn) #3174

@pyalot

Description

@pyalot

Description

If an exception is thrown in an event handler (such as $.ready), it is silently swalloed.

There are many cases in which exceptions are used to indicate errors for situations that are not code errors, for instance:

var foo = function(arg){
  var result = parseFloat(arg);
  if(isNaN(result)){ 
    throw new Error('not a number');
  }
};

Exceptions like that may be cought by the user, such as when the number is user-input. But they may also indicate errors in the usage of the code (such as foo('123') ), in which case catching them is counter productive since they can't be debugged anymore.

Link to test case

http://jsbin.com/bazaxixihe/edit?html,js,output

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions