Skip to content

Commit f55d281

Browse files
committed
Revert "polish raven.d.ts (#827)"
This reverts commit 4e12341.
1 parent f704d02 commit f55d281

File tree

3 files changed

+187
-376
lines changed

3 files changed

+187
-376
lines changed

typescript/raven-tests.ts

Lines changed: 47 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,70 @@
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+
};
2224

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();
2526

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+
};
2830

31+
try {
32+
throwsError();
33+
} catch(e) {
34+
Raven.captureException(e);
35+
Raven.captureException(e, {tags: { key: "value" }});
36+
}
2937

30-
// context:
3138
Raven.context(throwsError);
3239
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)();
3443

3544
Raven.setUserContext({
3645
email: 'matt@example.com',
3746
id: '123'
3847
});
3948

4049
Raven.setExtraContext({foo: 'bar'});
41-
4250
Raven.setTagsContext({env: 'prod'});
43-
4451
Raven.clearContext();
45-
4652
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();
6754

6855
Raven.captureMessage('Broken!');
6956
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');
7162

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) {});
7567

7668
Raven.showReportDialog({
77-
eventId: 0815,
78-
dsn:'1337asdf',
79-
user: {
80-
name: 'DefenitelyTyped',
81-
email: 'df@ts.ms'
82-
}
69+
eventId: 'abcdef123456'
8370
});
84-
85-
86-
var err:Error = Raven.lastException();

0 commit comments

Comments
 (0)