Skip to content

Commit 6ee5fe5

Browse files
author
Steven Wexler
committed
Added documentation for postToExceptionsJsPlatform
1 parent 4ad2bc6 commit 6ee5fe5

1 file changed

Lines changed: 25 additions & 15 deletions

File tree

README.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,41 @@
11
exceptions.js
22
======================
3-
_exceptions.js is currently in Beta and looking for users! Please file issues or feedback in the issues section or by emailing steven.m.wexler@gmail.com. Also, please email steven.m.wexler@gmail.com if you'd like to receive updates about this project including when it is released out of Beta._
4-
5-
exceptions.js enhances Javscript error handling by providing a more comprehensive API for errors and by extending functionality of window.onerror. exceptions.js is modeled off of C#'s exception infrastructure and provides the ability to record stacktraces, screenshots, inner exceptions with Javascript errors. It also provides the ability to make post request that contain serialized exceptions so you can record and report Javascript errors.
3+
Exceptions.js enhances Javscript error handling by providing a more comprehensive API for errors and by extending functionality of window.onerror. exceptions.js is modeled off of C#'s exception infrastructure and provides the ability to record stacktraces, screenshots, inner exceptions with Javascript errors. Exceptions.js easily integrates with exceptionsjs platform (https://www.exceptionsjs.com) which completes the exception reporting process by translating the exception into an email with stacktraces, screenshots, and other relevant information.
64

75
Basic setup and usage
86
----------------------
97
```javascript
10-
//Once you've included exceptions.js on your page:
8+
<script type="text/javascript" src="path/to/exceptions.js"></script>
119

1210
//Setup the exceptions handler to report errors when
1311
//you call Exception.report() or window.onerror executes
1412
exceptions.handler
15-
.stacktraceUrl("http://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/0.6.0/stacktrace.js")
16-
.html2canvasUrl("http://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js")
17-
.postUrl("http://localhost/handleException")
18-
.callback(function (exception) {
19-
console.log("We reported an exception!");
20-
console.log(exception);
21-
});
13+
//Posting to exceptionsjs platform is the easiest way to track your exceptions.
14+
//Register for free at https://www.exceptionsjs.com.
15+
.postToExceptionsJsPlatform("CLIENT_ID")
16+
//Set a custom postUrl if you want to bypass the exceptionsjs platform and handle the exception yourself.
17+
.postUrl("http://localhost/path/to/errorhandler/");
2218
```
2319
2420
```javascript
2521
//Report an exception.
26-
var exception = new exceptions.Exception("Oh no!");
22+
var exception = new exceptions.Exception("Something went wrong!");
2723
exception.report();
2824

2925
//Throw an exception. The exceptions.handler will handle this thrown error when window.onerror is executed.
30-
throw new exceptions.Exception("Oh no!");
26+
throw new exceptions.Exception("Something went wrong!");
3127

3228
//Include extra data with the exception.
33-
throw new exceptions.Exception("Oh no!", {
29+
throw new exceptions.Exception("Something went wrong!", {
3430
data: {
3531
foo: "bar"
3632
}
3733
});
3834

3935
//The exceptions.handler will handle this thrown error when window.onerror is executed. However,
4036
//you may find it more useful to throw an Exception rather than any arbirary object :)
41-
throw "Oh no!";
37+
throw Error("Something went wrong!");
38+
throw "Something went wrong!";
4239

4340
```
4441

@@ -432,6 +429,19 @@ _return_
432429
| ---- | ----------- |
433430
| handler|function | Handler if callback is defined. Callback if callback is not defined. |
434431
432+
###### postToExceptionsjsPlatform
433+
Enable posting to exceptionsjs platform. The exceptionsjs platform handles your Javascript error by parsing the serialized exception and constructing a useful exception email that includes stacktraces, screenshots, and extra information. Register for exceptionsjs platform at https://exceptionsjs.com. This option only works if you've enabled the option to allow unsecure reporting. If you have enabled secure reporting you must send your exceptions to excpetionsjs platform using the full oauth2 process. See https://exceptionsjs.com for useful libraries in many languages that make submitting exceptions with the full oauth2 process easy.
434+
435+
| Parameter | Type | Required | Description |
436+
| --------- | ---- | -------- | ----------- |
437+
| clientId | string | no | clientId that will be used with exceptionsjs platform |
438+
| to | string | no | email address that will receive the exception |
439+
440+
_return_
441+
442+
| Type | Description |
443+
| ---- | ----------- |
444+
| handler|string | Handler if clientId is defined. ClientId if clientId is not defined. |
435445
436446
###### loadStacktraceJs
437447
Asynchronously load stacktrace.js

0 commit comments

Comments
 (0)