Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
marpies committed Nov 23, 2016
1 parent a5c98b6 commit 0be442e
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can find the final compiled ANE binary along with the swc file in the bin fo

When using the extension on the Android platform you'll need to add the following permissions in the app manifest file:

```
```xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Expand All @@ -42,21 +42,21 @@ Before you can begin tracking bugs you will need to set up a two new projects on

Start off by initializing the Bugsnag extension with your API key:

```
```as3
Bugsnag.init("IOS_KEY", "ANDROID_KEY");
```

### Catch Unhandled Errors (Optional)

Bugsnag can catch and report unhandled errors in Actionscript. You'll need access to your app's loaderInfo object do to this. Use the following code:

```
```as3
loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, Bugsnag.handleUncaughtError);
```

Alternatively you can catch unhandled errors yourself and pass them directly into Bugsnag for reporting:

```
```as3
Bugsnag.notifyError(event.error);
```

Expand All @@ -66,8 +66,14 @@ Unhandled errors and crashes in the native code are already set up and do not re

If you'd like Bugsnag to record stack traces for errors (highly recommended), add the following code:

```
Bugsnag.getStackTrace = function(error:Error):String{return error.getStackTrace();}
```as3
Bugsnag.getStackTrace = function(error:*):String {
if(error is Error)
{
return Error(error).getStackTrace();
}
return null;
}
```

## Using the Extension
Expand All @@ -82,7 +88,7 @@ Native exceptions and crashes are reported automatically.

You can easily track handled errors using the following code:

```
```as3
try
{
Expand All @@ -95,33 +101,33 @@ catch(e:Error)

You can also pass in a severity value to the method:

```
```as3
Bugsnag.notifyError(new Error(), Severity.WARN);
```

### Track Manual Errors

You aren't limited to tracking only ```Error``` objects. You can send a generic error:

```
```as3
Bugsnag.notify("Big Error", "A really big error has occurred");
```

You can also add a severity to it:

```
```as3
Bugsnag.notify("Big Error", "A really big error has occurred", Severity.INFO);
```

It may be helpful to provide a stacktrace of where the error occurred:

```
```as3
Bugsnag.notify("Big Error", "A really big error has occurred", Severity.INFO, new Error().getStackTrace());
```

You can also provide additional metadata for errors that will show up in a custom tab on the Bugsnag dashboard. Each metadata object will display as a new tab.

```
```as3
var metadata:Metadata = new Metadata("Error Details");
metadata.addAttribute("Description", "Something went really wrong");
Expand All @@ -134,7 +140,7 @@ Bugsnag.notify("Big Error", "A really big error has occurred", Serverity.INFO, n

You can set custom data for users to track their errors:

```
```as3
Bugsnag.setUser("123456", "user_123456", "[email protected]");
```

Expand All @@ -144,7 +150,7 @@ By default the iOS extension will use the IDFV for the user id. Android will gen

You can tell Bugsnag which release stage your app is in to more easily group errors:

```
```as3
Bugsnag.releaseStage = ReleaseStage.DEVELOPMENT;
```

Expand All @@ -155,15 +161,15 @@ By default the release stage is set to ```PRODUCTION```.

You can enable or disable auto notification of unhandled exceptions:

```
```as3
Bugsnag.autoNotify = false;
```

### Notify Release Stages

You can also tell Bugsnag to only notify errors in certain production stages:

```
```as3
Bugsnag.notifyReleaseStages = [ReleaseStage.PRODUCTION];
```

Expand All @@ -173,19 +179,19 @@ The code above restricts automatic notification to production stages only. Error

You can add custom data and custom tabs to your error reports. The following code adds custom data to the 'user' tab:

```
```as3
Bugsnag.addAttribute("City", "New York", "User");
```

You can also remove attributes:

```
```as3
Bugsnag.removeAttribute("Attribute", "Tab Name");
```

Or even remove entire custom tabs:

```
```as3
Bugsnag.removeTab("My Tab");
```

Expand All @@ -195,7 +201,7 @@ Note that custom tabs will show up for every error that you log, including nativ

The context represents the state the application is in before the error. You can set the context:

```
```as3
Bugsnag.context = "Store";
```

Expand Down

0 comments on commit 0be442e

Please sign in to comment.