react-native-bugsnag
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -27,2 +27,8 @@ /** | ||
RNBugsnag(); //init so that we start listening to js errors | ||
RNBugsnag().setReleaseStage("staging"); | ||
RNBugsnag().setContext("examplePage"); | ||
const codepushBundleVersion = "42"; | ||
RNBugsnag().setAppVersion(`1.0.1(${codepushBundleVersion})`) | ||
} | ||
@@ -36,3 +42,3 @@ | ||
</Text> | ||
<Text style={styles.instructions}> | ||
@@ -43,11 +49,8 @@ iOS: Go to the Info.plist within the iOS native project and add your ApiKey,{'\n\n'} | ||
<TouchableOpacity style={styles.button} onPress={()=>{ | ||
// alert("On crash") | ||
throw new Error("Javascript error test successful!") | ||
}}> | ||
<Text style={styles.buttonText}> | ||
Test crash {Platform.OS} | ||
</Text> | ||
</TouchableOpacity> | ||
<Button onPress={() => { throw new Error("Javascript error test successful!"); } } | ||
text={`Test crash ${Platform.OS}`} /> | ||
<Button onPress={() => { RNBugsnag().leaveBreadcrumb(`Breadcrumb button pressed!`); } } | ||
text={"Leave breadcrumb"} /> | ||
</View> | ||
@@ -58,5 +61,12 @@ ); | ||
const Button = props => { | ||
const { onPress, text } = props; | ||
return ( | ||
<TouchableOpacity style={styles.button} onPress={onPress}> | ||
<Text style={styles.buttonText}> { text } </Text> | ||
</TouchableOpacity> | ||
); | ||
}; | ||
const styles = StyleSheet.create({ | ||
@@ -83,2 +93,3 @@ container: { | ||
backgroundColor: '#5856D6', | ||
marginVertical: 5, | ||
paddingVertical: 15, | ||
@@ -94,2 +105,1 @@ paddingHorizontal: 10, | ||
}); | ||
@@ -68,4 +68,6 @@ import React from 'react-native'; | ||
if((!!props && props.suppressDevErrors===true) || (__DEV__===true)) { | ||
this.setSuppressDebugOnDev(true); | ||
if(!!props && props.suppressDevErrors!=null) { //if the user has specified wether to suppress or not | ||
this.setSuppressDebugOnDev(!!props.suppressDevErrors); //do what the user wishes to do | ||
}else{ //otherwise | ||
this.setSuppressDebugOnDev(__DEV__===true); // if on DEV suppress all the errors, otherwise don't | ||
} | ||
@@ -96,3 +98,18 @@ | ||
async leaveBreadcrumb(message){ | ||
return await NativeBugsnag.leaveBreadcrumb(message); | ||
} | ||
async setContext(context){ | ||
return await NativeBugsnag.setContext(context); | ||
} | ||
async setReleaseStage(releaseStage){ | ||
return await NativeBugsnag.setReleaseStage(releaseStage); | ||
} | ||
async setAppVersion(appVersion){ | ||
return await NativeBugsnag.setAppVersion(appVersion); | ||
} | ||
async setIdentifier(userId, userEmail, userFullname){ | ||
@@ -99,0 +116,0 @@ return await NativeBugsnag.setIdentifier(userId, userEmail, userFullname); |
{ | ||
"name": "react-native-bugsnag", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Community-created Bugsnag package for React Native. It consumes the Bugsnag API to report errors from both the React Native (Javascript) environment AND the native (Obj-C or Java) environment.", | ||
@@ -5,0 +5,0 @@ "nativePackage": true, |
@@ -104,3 +104,3 @@ # React Native Bugsnag | ||
2. Go to your app.gradle and add the following line in the end: | ||
2. Go to your app/settings.gradle and add the following line in the end: | ||
```java | ||
@@ -122,3 +122,3 @@ dependencies { | ||
4. Go to your `MainActivity.java` and add the following code: | ||
4. Go to your `MainApplication.java` and add the following code: | ||
@@ -195,4 +195,38 @@ ``` | ||
Bugsnag().setIdentifier("aUserId", "aUserEmail", "userFullname"); | ||
``` | ||
``` | ||
#### Logging breadcrumbs | ||
> In order to understand what happened in your application before each crash, it can be helpful to leave short log statements that we call breadcrumbs. The last several breadcrumbs are attached to a crash to help diagnose what events lead to the error. – Bugsnag | ||
```js | ||
Bugsnag().leaveBreadcrumb("some actions were done") | ||
``` | ||
#### Setting Release Stage | ||
> In order to distinguish between errors that occur in different stages of the application release process a release stage is sent to Bugsnag when an error occurs – Bugsnag | ||
```js | ||
Bugsnag().setReleaseStage("staging"); | ||
``` | ||
#### Setting Context | ||
> Bugsnag uses the concept of “contexts” to help display and group your errors. Contexts represent what was happening in your application at the time an error occurs. – Bugsnag | ||
```js | ||
Bugsnag().setContext("loginPage"); | ||
``` | ||
#### Setting AppVersion | ||
> If you want to manually track in which versions of your application each exception happens, you can set appVersion. – Bugsnag | ||
This will be useful when using OTA updates. | ||
```js | ||
Bugsnag().setAppVersion(`${appBinaryVersion}(${codepushBundleVersion})`); | ||
``` | ||
#### Handled errors (Manual dispatch): | ||
@@ -199,0 +233,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2264669
2497
292
0