mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #592 from spicyj/guard-fn
ReactErrorUtils: In prod, just return the original
This commit is contained in:
Vendored
+10
-8
@@ -28,16 +28,18 @@ var ReactErrorUtils = {
|
||||
* @return {function}
|
||||
*/
|
||||
guard: function(func, name) {
|
||||
return function guarded() {
|
||||
try {
|
||||
return func.apply(this, arguments);
|
||||
} catch(ex) {
|
||||
if (__DEV__) {
|
||||
if (__DEV__) {
|
||||
return function guarded() {
|
||||
try {
|
||||
return func.apply(this, arguments);
|
||||
} catch(ex) {
|
||||
console.error(name + ': ' + ex.message);
|
||||
throw ex;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
};
|
||||
};
|
||||
} else {
|
||||
return func;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user