Skip to content

Commit a44c149

Browse files
Empactsalmamali
authored andcommitted
Restore ability to destructure InstabugUtils (#259)
Make use of that ability in the library. Sensible because Utils is not a meaningful collection.
1 parent 62b7863 commit a44c149

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import {
66
processColor
77
} from 'react-native';
88
let { Instabug } = NativeModules;
9-
import InstabugUtils from './utils/InstabugUtils';
9+
import { parseErrorStack, captureJsErrors } from './utils/InstabugUtils';
1010
import BugReporting from './modules/BugReporting';
1111
import Surveys from './modules/Surveys';
1212
import FeatureRequests from './modules/FeatureRequests';
1313
import Chats from './modules/Chats';
1414
import Replies from './modules/Replies';
1515
import CrashReporting from './modules/CrashReporting';
1616

17-
InstabugUtils.captureJsErrors();
17+
captureJsErrors();
1818

1919
/**
2020
* Instabug
@@ -609,7 +609,7 @@ const InstabugModule = {
609609
*/
610610

611611
reportJSException: function(errorObject) {
612-
let jsStackTrace = InstabugUtils.parseErrorStack(errorObject);
612+
let jsStackTrace = parseErrorStack(errorObject);
613613
var jsonObject = {
614614
message: errorObject.name + ' - ' + errorObject.message,
615615
os: Platform.OS,

modules/CrashReporting.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NativeModules, Platform } from 'react-native';
2-
import InstabugUtils from '../utils/InstabugUtils';
2+
import { parseErrorStack } from '../utils/InstabugUtils';
33
let { Instabug } = NativeModules;
44

55
/**
@@ -22,7 +22,7 @@ export default {
2222
* @param errorObject Error object to be sent to Instabug's servers
2323
*/
2424
reportJSException: function(errorObject) {
25-
let jsStackTrace = InstabugUtils.parseErrorStack(errorObject);
25+
let jsStackTrace = parseErrorStack(errorObject);
2626
var jsonObject = {
2727
message: errorObject.name + ' - ' + errorObject.message,
2828
os: Platform.OS,

utils/InstabugUtils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import {NativeModules, Platform} from 'react-native';
33
let {Instabug} = NativeModules;
44
import parseErrorStackLib from '../../react-native/Libraries/Core/Devtools/parseErrorStack.js';
55

6-
let parseErrorStack = (error) => {
6+
export const parseErrorStack = (error) => {
77
return parseErrorStackLib(error);
88
};
99

1010
const originalHandler = global.ErrorUtils.getGlobalHandler();
1111

12-
let init = () => {
12+
export const captureJsErrors = () => {
1313
if (__DEV__) {
1414
return;
1515
}
@@ -43,6 +43,6 @@ let init = () => {
4343
};
4444

4545
export default {
46-
parseErrorStack: parseErrorStack,
47-
captureJsErrors: init
46+
parseErrorStack,
47+
captureJsErrors
4848
};

0 commit comments

Comments
 (0)