@@ -15,6 +15,88 @@ used to report errors from browser and node environments. The quality
15
15
of reporting will heavily depend on the environment the data is submitted
16
16
from.
17
17
18
+ Installation
19
+ ------------
20
+
21
+ Raven.js is distributed in a few different methods, and should get
22
+ included after any other libraries are included, but before your own
23
+ scripts. For all details see :doc: `install `. For just getting started,
24
+ you can use our CDN:
25
+
26
+ .. sourcecode :: html
27
+
28
+ <script src="//cdn.ravenjs.com/1.1.19/raven.min.js"></script>
29
+
30
+ Configuring the Client
31
+ ----------------------
32
+
33
+ We must first configure Sentry to allow certain hosts to report errors.
34
+ This prevents abuse so somebody else couldn't start sending errors to your
35
+ account from their site. This can be found under the *Project Details *
36
+ page in Sentry.
37
+
38
+ Now need to set up Raven.js to use your Sentry DSN:
39
+
40
+ .. code-block :: javascript
41
+
42
+ Raven .config (' ___PUBLIC_DSN___' ).install ()
43
+
44
+ At this point, Raven is ready to capture any uncaught exception.
45
+
46
+ Although, this technically works, this is not going to yield the greatest
47
+ results. It's highly recommended to next check out :doc: `config ` and
48
+ :doc: `usage ` after you have it up and running to improve your results.
49
+
50
+ Reporting Errors
51
+ ----------------
52
+
53
+ The simplest way, is to try and explicitly capture and report potentially
54
+ problematic code with a ``try...catch `` block and
55
+ ``Raven.captureException ``.
56
+
57
+ .. code-block :: javascript
58
+
59
+ try {
60
+ doSomething (a[0 ])
61
+ } catch (e) {
62
+ Raven .captureException (e)
63
+ }
64
+
65
+ There are more ways to report errors. For a complete guide on this see
66
+ :ref: `raven-js-reporting-errors `.
67
+
68
+ Tracking Users
69
+ --------------
70
+
71
+ While a user is logged in, you can tell Sentry to associate errors with
72
+ user data. This data is then submitted with each error which allows you
73
+ to figure out which users are affected.
74
+
75
+ .. code-block :: javascript
76
+
77
+ Raven .setUserContext ({
78
+
79
+ id: ' 123'
80
+ })
81
+
82
+ If at any point, the user becomes unauthenticated, you can call
83
+ ``Raven.setUserContext() `` with no arguments to remove their data.
84
+
85
+ Dealing with Minified Source Code
86
+ ---------------------------------
87
+
88
+ Raven and Sentry support `Source Maps
89
+ <http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/> `_. If
90
+ you provide source maps in addition to your minified files that data
91
+ becomes available in Sentry. For more information see
92
+ :ref: `raven-js-sourcemaps `.
93
+
94
+ Deep Dive
95
+ ---------
96
+
97
+ For more detailed information about how to get most out of Raven.js there
98
+ is additional documentation available that covers all the rest:
99
+
18
100
.. toctree ::
19
101
:maxdepth: 2
20
102
:titlesonly:
0 commit comments