From e0a0cac280cbe044862d35adf715b679d418d0de Mon Sep 17 00:00:00 2001 From: Qiao Liang Date: Thu, 18 Feb 2016 05:40:12 -0800 Subject: [PATCH] add getter as public api for ErrorUtils._globalHandler Summary:As discussed here #1194 . This add an getter the default handler, so that custom handler can be added (monkey patch?) without overwriting the default handler Closes https://github.com/facebook/react-native/pull/5575 Differential Revision: D2948994 fb-gh-sync-id: 2b6d1619cfe68f78b326c6d232b9bf57c489c45d shipit-source-id: 2b6d1619cfe68f78b326c6d232b9bf57c489c45d --- packager/react-packager/src/Resolver/polyfills/error-guard.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packager/react-packager/src/Resolver/polyfills/error-guard.js b/packager/react-packager/src/Resolver/polyfills/error-guard.js index 8810a4b12..d013ec110 100644 --- a/packager/react-packager/src/Resolver/polyfills/error-guard.js +++ b/packager/react-packager/src/Resolver/polyfills/error-guard.js @@ -20,6 +20,9 @@ var ErrorUtils = { setGlobalHandler: function(fun) { ErrorUtils._globalHandler = fun; }, + getGlobalHandler: function() { + return ErrorUtils._globalHandler; + }, reportError: function(error) { ErrorUtils._globalHandler && ErrorUtils._globalHandler(error); },