|
1 |
| -import Raven, {RavenOutgoingData} from "./raven" |
2 |
| - |
3 |
| -// configuring: |
4 |
| -Raven.config('https://public@getsentry.com/1').install(); |
5 |
| - |
6 |
| -Raven.config( |
7 |
| - 'https://public@getsentry.com/1', |
8 |
| - { |
9 |
| - logger: 'my-logger', |
10 |
| - ignoreUrls: [ |
11 |
| - /graph\.facebook\.com/i |
12 |
| - ], |
13 |
| - ignoreErrors: [ |
14 |
| - 'fb_xd_fragment' |
15 |
| - ], |
16 |
| - includePaths: [ |
17 |
| - /https?:\/\/(www\.)?getsentry\.com/, |
18 |
| - /https?:\/\/d3nslu0hdya83q\.cloudfront\.net/ |
19 |
| - ] |
20 |
| - } |
21 |
| -).install(); |
| 1 | +import Raven = require('..'); |
| 2 | + |
| 3 | +Raven.config('https://public@sentry.io/1').install(); |
| 4 | + |
| 5 | +var options = { |
| 6 | + logger: 'my-logger', |
| 7 | + ignoreUrls: [ |
| 8 | + /graph\.facebook\.com/i, |
| 9 | + 'graph.facebook.com' |
| 10 | + ], |
| 11 | + ignoreErrors: [ |
| 12 | + /fb_xd_fragment/, |
| 13 | + 'fb_xd_fragment' |
| 14 | + ], |
| 15 | + includePaths: [ |
| 16 | + /https?:\/\/(www\.)?getsentry\.com/, |
| 17 | + 'https://www.sentry.io' |
| 18 | + ], |
| 19 | + whitelistUrls: [ |
| 20 | + /https?:\/\/google\.com/, |
| 21 | + 'https://www.google.com' |
| 22 | + ] |
| 23 | +}; |
22 | 24 |
|
23 |
| -Raven.setDataCallback((data: RavenOutgoingData) => {return data}); |
24 |
| -Raven.setDataCallback(function (data: RavenOutgoingData, original: string) {return data}); |
| 25 | +Raven.config('https://public@sentry.io/1', options).install(); |
25 | 26 |
|
26 |
| -Raven.setShouldSendCallback((data: RavenOutgoingData) => {return data}); |
27 |
| -Raven.setShouldSendCallback(function (data: RavenOutgoingData, original: string) {return data}); |
| 27 | +var throwsError = () => { |
| 28 | + throw new Error('broken'); |
| 29 | +}; |
28 | 30 |
|
| 31 | +try { |
| 32 | + throwsError(); |
| 33 | +} catch(e) { |
| 34 | + Raven.captureException(e); |
| 35 | + Raven.captureException(e, {tags: { key: "value" }}); |
| 36 | +} |
29 | 37 |
|
30 |
| -// context: |
31 | 38 | Raven.context(throwsError);
|
32 | 39 | Raven.context({tags: { key: "value" }}, throwsError);
|
33 |
| -Raven.context({extra: {planet: {name: 'Earth'}}}, throwsError); |
| 40 | + |
| 41 | +setTimeout(Raven.wrap(throwsError), 1000); |
| 42 | +Raven.wrap({logger: "my.module"}, throwsError)(); |
34 | 43 |
|
35 | 44 | Raven.setUserContext({
|
36 | 45 | email: 'matt@example.com',
|
37 | 46 | id: '123'
|
38 | 47 | });
|
39 | 48 |
|
40 | 49 | Raven.setExtraContext({foo: 'bar'});
|
41 |
| - |
42 | 50 | Raven.setTagsContext({env: 'prod'});
|
43 |
| - |
44 | 51 | Raven.clearContext();
|
45 |
| - |
46 | 52 | var obj:Object = Raven.getContext();
|
47 |
| - |
48 |
| -Raven.setRelease('abc123'); |
49 |
| -Raven.setEnvironment('production'); |
50 |
| - |
51 |
| -setTimeout(Raven.wrap(throwsError), 1000); |
52 |
| -Raven.wrap({logger: "my.module"}, throwsError)(); |
53 |
| -Raven.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)(); |
54 |
| - |
55 |
| - |
56 |
| -// reporting: |
57 |
| -var throwsError = () => { |
58 |
| - throw new Error('broken'); |
59 |
| -}; |
60 |
| - |
61 |
| -try { |
62 |
| - throwsError(); |
63 |
| -} catch(e) { |
64 |
| - Raven.captureException(e); |
65 |
| - Raven.captureException(e, {tags: { key: "value" }}); |
66 |
| -} |
| 53 | +var err:Error = Raven.lastException(); |
67 | 54 |
|
68 | 55 | Raven.captureMessage('Broken!');
|
69 | 56 | Raven.captureMessage('Broken!', {tags: { key: "value" }});
|
70 |
| -Raven.captureMessage('Broken!', { stacktrace: true }); |
| 57 | ++Raven.captureMessage('Broken!', { stacktrace: true }); |
| 58 | +Raven.captureBreadcrumb({}); |
| 59 | + |
| 60 | +Raven.setRelease('abc123'); |
| 61 | +Raven.setEnvironment('production'); |
71 | 62 |
|
72 |
| -Raven.captureBreadcrumb({ message: 'message' }); |
73 |
| -Raven.captureBreadcrumb({ category: 'category', message: 'message' }); |
74 |
| -Raven.captureBreadcrumb({ category: 'category', message: 'message', data: { id: '42' }, level: 'level' }); |
| 63 | +Raven.setDataCallback(function (data: any) {}); |
| 64 | +Raven.setDataCallback(function (data: any, original: any) {}); |
| 65 | +Raven.setShouldSendCallback(function (data: any) {}); |
| 66 | +Raven.setShouldSendCallback(function (data: any, original: any) {}); |
75 | 67 |
|
76 | 68 | Raven.showReportDialog({
|
77 |
| - eventId: 0815, |
78 |
| - dsn:'1337asdf', |
79 |
| - user: { |
80 |
| - name: 'DefenitelyTyped', |
81 |
| - email: 'df@ts.ms' |
82 |
| - } |
| 69 | + eventId: 'abcdef123456' |
83 | 70 | });
|
84 |
| - |
85 |
| - |
86 |
| -var err:Error = Raven.lastException(); |
0 commit comments