Merge pull request #592 from spicyj/guard-fn

ReactErrorUtils: In prod, just return the original
This commit is contained in:
Paul O’Shannessy
2013-12-06 11:31:02 -08:00
+10 -8
View File
@@ -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;
}
}
};