mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Disable guarding in ReactErrorUtils
With #1021 and #1022, I believe this makes it so React never wraps user code in a try/catch. I left in the calls to ReactErrorUtils.guard because it sounds like FB code finds them useful.
This commit is contained in:
Vendored
+5
-14
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user