Skip to content

polish raven.d.ts #827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Mar 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ef30661
polished raven.d.ts
LucaVazz Jan 12, 2017
98a83c1
updated author information of raven.d.ts
LucaVazz Jan 12, 2017
2e590d2
added extra to RavenUserContext
LucaVazz Jan 12, 2017
cc9fc47
small fixes
LucaVazz Jan 12, 2017
592e542
copied fixes from PR in DefenitivelyTyped
LucaVazz Jan 13, 2017
089efdd
fixed tsc --noEmit --noImplicitAny typescript/raven-tests.ts
LucaVazz Jan 23, 2017
305d38b
made `data: any` in set...Calback more specific
LucaVazz Jan 24, 2017
949bc5d
added missing values to RavenOutgoingData
LucaVazz Jan 24, 2017
d0d32c8
replaced any in setBreadcrumbCallback
LucaVazz Jan 24, 2017
e562d5c
made options for setTransport more specific
LucaVazz Jan 24, 2017
a53a044
set user in RavenOutgoingData to RavenUserContext instead of any
LucaVazz Jan 24, 2017
f46fde8
fixed missed RavenTransportOptions (-> RavenTransportFunctionOptions …
LucaVazz Jan 24, 2017
7fdef1f
fixed interface-props terminated by `;` to be terminated by `;`
LucaVazz Jan 24, 2017
9f38a30
Merge branch 'master' of https://github.com/getsentry/raven-js
LucaVazz Jan 24, 2017
1f55f01
re-added accidentally deleted tests (in a fixed version)
LucaVazz Jan 31, 2017
3e51fc6
fixed typo in RavenBreadcrumbOptions
LucaVazz Jan 31, 2017
ac60fe3
added a proposal for a PR-Template
LucaVazz Jan 31, 2017
10d48cc
removed redundant testing from the PR-Template
LucaVazz Jan 31, 2017
60a7809
fix optionals in RavenBreadcrumb
LucaVazz Feb 16, 2017
5e92191
added tests for captureBreadcrumb
LucaVazz Feb 16, 2017
634908c
fixed erroneous optionals from the last commit
LucaVazz Feb 16, 2017
d8941cf
removed PR-Template
LucaVazz Feb 19, 2017
e034ba6
Merge branch 'master' of https://github.com/LucaVazz/raven-js
LucaVazz Feb 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 63 additions & 47 deletions typescript/raven-tests.ts
Original file line number Diff line number Diff line change
@@ -1,70 +1,86 @@
import Raven = require('..');

Raven.config('https://public@sentry.io/1').install();

var options = {
logger: 'my-logger',
ignoreUrls: [
/graph\.facebook\.com/i,
'graph.facebook.com'
],
ignoreErrors: [
/fb_xd_fragment/,
'fb_xd_fragment'
],
includePaths: [
/https?:\/\/(www\.)?getsentry\.com/,
'https://www.sentry.io'
],
whitelistUrls: [
/https?:\/\/google\.com/,
'https://www.google.com'
]
};
import Raven, {RavenOutgoingData} from "./raven"

Raven.config('https://public@sentry.io/1', options).install();
// configuring:
Raven.config('https://public@getsentry.com/1').install();

var throwsError = () => {
throw new Error('broken');
};
Raven.config(
'https://public@getsentry.com/1',
{
logger: 'my-logger',
ignoreUrls: [
/graph\.facebook\.com/i
],
ignoreErrors: [
'fb_xd_fragment'
],
includePaths: [
/https?:\/\/(www\.)?getsentry\.com/,
/https?:\/\/d3nslu0hdya83q\.cloudfront\.net/
]
}
).install();

try {
throwsError();
} catch(e) {
Raven.captureException(e);
Raven.captureException(e, {tags: { key: "value" }});
}
Raven.setDataCallback((data: RavenOutgoingData) => {return data});
Raven.setDataCallback(function (data: RavenOutgoingData, original: string) {return data});

Raven.setShouldSendCallback((data: RavenOutgoingData) => {return data});
Raven.setShouldSendCallback(function (data: RavenOutgoingData, original: string) {return data});


// context:
Raven.context(throwsError);
Raven.context({tags: { key: "value" }}, throwsError);

setTimeout(Raven.wrap(throwsError), 1000);
Raven.wrap({logger: "my.module"}, throwsError)();
Raven.context({extra: {planet: {name: 'Earth'}}}, throwsError);

Raven.setUserContext({
email: 'matt@example.com',
id: '123'
});

Raven.setExtraContext({foo: 'bar'});

Raven.setTagsContext({env: 'prod'});

Raven.clearContext();
var obj:Object = Raven.getContext();
var err:Error = Raven.lastException();

Raven.captureMessage('Broken!');
Raven.captureMessage('Broken!', {tags: { key: "value" }});
+Raven.captureMessage('Broken!', { stacktrace: true });
Raven.captureBreadcrumb({});
var obj:Object = Raven.getContext();

Raven.setRelease('abc123');
Raven.setEnvironment('production');

Raven.setDataCallback(function (data: any) {});
Raven.setDataCallback(function (data: any, original: any) {});
Raven.setShouldSendCallback(function (data: any) {});
Raven.setShouldSendCallback(function (data: any, original: any) {});
setTimeout(Raven.wrap(throwsError), 1000);
Raven.wrap({logger: "my.module"}, throwsError)();
Raven.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();


// reporting:
var throwsError = () => {
throw new Error('broken');
};

try {
throwsError();
} catch(e) {
Raven.captureException(e);
Raven.captureException(e, {tags: { key: "value" }});
}

Raven.captureMessage('Broken!');
Raven.captureMessage('Broken!', {tags: { key: "value" }});
Raven.captureMessage('Broken!', { stacktrace: true });

Raven.captureBreadcrumb({ message: 'message' });
Raven.captureBreadcrumb({ category: 'category', message: 'message' });
Raven.captureBreadcrumb({ category: 'category', message: 'message', data: { id: '42' }, level: 'level' });

Raven.showReportDialog({
eventId: 'abcdef123456'
eventId: 0815,
dsn:'1337asdf',
user: {
name: 'DefenitelyTyped',
email: 'df@ts.ms'
}
});


var err:Error = Raven.lastException();
Loading