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.
Ben Alpert committed
Feb 9, 2014 at 22:08 UTC
8f298fbd693c93ec4e5f46eaf29675e01114d0a3
1 file changed
+5
-14
src/vendor/stubs/ReactErrorUtils.js
+5
-14
@@ -17,29 +17,20 @@
17
* @typechecks
18
*/
19
20
+"use strict";
21
+
22
var ReactErrorUtils = {
23
/**
24
* Creates a guarded version of a function. This is supposed to make debugging
23
- * of event handlers easier. This implementation provides only basic error
24
- * logging and re-throws the error.
25
+ * of event handlers easier. To aid debugging with the browser's debugger,
26
+ * this currently simply returns the original function.
27
*
28
* @param {function} func Function to be executed
29
* @param {string} name The name of the guard
30
* @return {function}
31
*/
32
guard: function(func, name) {
31
- if (__DEV__) {
32
- return function guarded() {
33
- try {
34
- return func.apply(this, arguments);
35
- } catch(ex) {
36
- console.error(name + ': ' + ex.message);
37
- throw ex;
38
- }
39
- };
40
- } else {
41
- return func;
42
- }
33
+ return func;
34
}
35
};
36