Skip to content

Commit 630cd8f

Browse files
author
Steven Wexler
committed
Updated intro documentation to be clearer
1 parent 26b9ff1 commit 630cd8f

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
exceptions.js
22
======================
3-
Exceptions.js provides error reporting with stacktraces, screenshots, DOM dumps, browser information, etc. The library can be used as a standalone open source project or can be used with the exceptionsjs platform (https://www.exceptionsjs.com) which translates reported exceptions into emails and delivers them to registered developers. See demos here: https://www.exceptionsjs.com/demo.
3+
Exceptions.js is the library that makes Javascript Errors useful. Include stacktraces, screenshots, DOM dumps, browser information, etc. when users hit Javascript errors. The library can be used as a standalone open source project or can be used with the exceptionsjs platform (https://www.exceptionsjs.com) which translates reported exceptions into emails and delivers them to registered developers. See demos here: https://www.exceptionsjs.com/demo.
44

55
Basic setup and usage
66
----------------------
@@ -19,24 +19,30 @@ exceptions.handler
1919
```
2020
2121
```javascript
22-
//The exceptions.handler will handle this thrown error when window.onerror is executed. However,
23-
//you may find it more useful to throw an Exception rather than any arbirary object :)
22+
//exceptions.js will handle any error.
23+
var foo = {}, oops = foo.uhoh.doesNotExist;
2424
throw new Error("Something went wrong!");
2525
throw "Something went wrong!";
2626

27-
//Report an exception.
28-
var exception = new exceptions.Exception("Something went wrong!");
29-
exception.report();
27+
//you can also report exceptions.
28+
new exceptions.Exception("Something went wrong!").report();
3029

31-
//Throw an exception. The exceptions.handler will handle this thrown error when window.onerror is executed.
30+
//or throw an exception.
3231
throw new exceptions.Exception("Something went wrong!");
3332

34-
//Include extra data with the exception.
35-
throw new exceptions.Exception("Something went wrong!", {
36-
data: {
37-
foo: "bar"
38-
}
39-
});
33+
//exceptions.js provides convienence methods that make code more readable.
34+
function myFunc(requiredArg) {
35+
exceptions.throwIf(!requiredArg, "The requiredArg argument was not provided!!!");
36+
}
37+
38+
//and types that make errors more explicit
39+
function WillWriteInTheFuture() {
40+
throw exceptions.NotImplementedException();
41+
}
42+
43+
//and other useful features including support for inner exceptions,
44+
//ability to include extra data with your exceptions, abilities protect
45+
//against bursts or repeated exceptions
4046
```
4147

4248
API

0 commit comments

Comments
 (0)