Skip to content

Commit

Permalink
Merge pull request #1046 from spicyj/errutils
Browse files Browse the repository at this point in the history
Disable guarding in ReactErrorUtils
  • Loading branch information
zpao committed Feb 12, 2014
2 parents db6ff14 + 8f298fb commit da587b1
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/vendor/stubs/ReactErrorUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,20 @@
* @typechecks
*/

"use strict";

var ReactErrorUtils = {
/**
* Creates a guarded version of a function. This is supposed to make debugging
* of event handlers easier. This implementation provides only basic error
* logging and re-throws the error.
* of event handlers easier. To aid debugging with the browser's debugger,
* this currently simply returns the original function.
*
* @param {function} func Function to be executed
* @param {string} name The name of the guard
* @return {function}
*/
guard: function(func, name) {
if (__DEV__) {
return function guarded() {
try {
return func.apply(this, arguments);
} catch(ex) {
console.error(name + ': ' + ex.message);
throw ex;
}
};
} else {
return func;
}
return func;
}
};

Expand Down

0 comments on commit da587b1

Please sign in to comment.