You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-13Lines changed: 19 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
exceptions.js
2
2
======================
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.
4
4
5
5
Basic setup and usage
6
6
----------------------
@@ -19,24 +19,30 @@ exceptions.handler
19
19
```
20
20
21
21
```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;
24
24
thrownewError("Something went wrong!");
25
25
throw"Something went wrong!";
26
26
27
-
//Report an exception.
28
-
var exception =newexceptions.Exception("Something went wrong!");
29
-
exception.report();
27
+
//you can also report exceptions.
28
+
newexceptions.Exception("Something went wrong!").report();
30
29
31
-
//Throw an exception. The exceptions.handler will handle this thrown error when window.onerror is executed.
30
+
//or throw an exception.
32
31
thrownewexceptions.Exception("Something went wrong!");
33
32
34
-
//Include extra data with the exception.
35
-
thrownewexceptions.Exception("Something went wrong!", {
36
-
data: {
37
-
foo:"bar"
38
-
}
39
-
});
33
+
//exceptions.js provides convienence methods that make code more readable.
34
+
functionmyFunc(requiredArg) {
35
+
exceptions.throwIf(!requiredArg, "The requiredArg argument was not provided!!!");
36
+
}
37
+
38
+
//and types that make errors more explicit
39
+
functionWillWriteInTheFuture() {
40
+
throwexceptions.NotImplementedException();
41
+
}
42
+
43
+
//and other useful features including support for inner exceptions,
44
+
//ability to include extra data with your exceptions, abilities protect
0 commit comments