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
This commit is contained in:
Qiao Liang 2016-02-18 05:40:12 -08:00 committed by facebook-github-bot-5
parent 62ac6aeb40
commit e0a0cac280
1 changed files with 3 additions and 0 deletions

View File

@ -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);
},