Skip to content

Commit 0be442e

Browse files
committed
Update README.md
1 parent a5c98b6 commit 0be442e

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

README.md

+26-20
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You can find the final compiled ANE binary along with the swc file in the bin fo
2626

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

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

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

45-
```
45+
```as3
4646
Bugsnag.init("IOS_KEY", "ANDROID_KEY");
4747
```
4848

4949
### Catch Unhandled Errors (Optional)
5050

5151
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:
5252

53-
```
53+
```as3
5454
loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, Bugsnag.handleUncaughtError);
5555
```
5656

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

59-
```
59+
```as3
6060
Bugsnag.notifyError(event.error);
6161
```
6262

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

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

69-
```
70-
Bugsnag.getStackTrace = function(error:Error):String{return error.getStackTrace();}
69+
```as3
70+
Bugsnag.getStackTrace = function(error:*):String {
71+
if(error is Error)
72+
{
73+
return Error(error).getStackTrace();
74+
}
75+
return null;
76+
}
7177
```
7278

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

8389
You can easily track handled errors using the following code:
8490

85-
```
91+
```as3
8692
try
8793
{
8894
@@ -95,33 +101,33 @@ catch(e:Error)
95101

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

98-
```
104+
```as3
99105
Bugsnag.notifyError(new Error(), Severity.WARN);
100106
```
101107

102108
### Track Manual Errors
103109

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

106-
```
112+
```as3
107113
Bugsnag.notify("Big Error", "A really big error has occurred");
108114
```
109115

110116
You can also add a severity to it:
111117

112-
```
118+
```as3
113119
Bugsnag.notify("Big Error", "A really big error has occurred", Severity.INFO);
114120
```
115121

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

118-
```
124+
```as3
119125
Bugsnag.notify("Big Error", "A really big error has occurred", Severity.INFO, new Error().getStackTrace());
120126
```
121127

122128
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.
123129

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

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

137-
```
143+
```as3
138144
Bugsnag.setUser("123456", "user_123456", "[email protected]");
139145
```
140146

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

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

147-
```
153+
```as3
148154
Bugsnag.releaseStage = ReleaseStage.DEVELOPMENT;
149155
```
150156

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

156162
You can enable or disable auto notification of unhandled exceptions:
157163

158-
```
164+
```as3
159165
Bugsnag.autoNotify = false;
160166
```
161167

162168
### Notify Release Stages
163169

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

166-
```
172+
```as3
167173
Bugsnag.notifyReleaseStages = [ReleaseStage.PRODUCTION];
168174
```
169175

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

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

176-
```
182+
```as3
177183
Bugsnag.addAttribute("City", "New York", "User");
178184
```
179185

180186
You can also remove attributes:
181187

182-
```
188+
```as3
183189
Bugsnag.removeAttribute("Attribute", "Tab Name");
184190
```
185191

186192
Or even remove entire custom tabs:
187193

188-
```
194+
```as3
189195
Bugsnag.removeTab("My Tab");
190196
```
191197

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

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

198-
```
204+
```as3
199205
Bugsnag.context = "Store";
200206
```
201207

0 commit comments

Comments
 (0)