Skip to content

ref: Added breadcrumbCallback and sentry breadcrumb TS typings #1133

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 1 commit into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions typescript/raven-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ var options: Raven.RavenOptions = {
xhr: false,
console: false,
dom: true,
location: false
location: false,
sentry: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sentry is sentry event breadcrumbs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it has been added here #1099

},
breadcrumbCallback: function (data) {
return data
}
};

Expand Down Expand Up @@ -60,7 +64,7 @@ var err:Error = Raven.lastException();

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks so confusing in the diff view

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯_(ツ)_/¯

Raven.captureMessage('Broken!', { stacktrace: true });
Raven.captureMessage('Warning', { level: 'warning' });
Raven.captureBreadcrumb({
message: "This is a breadcrumb message."
Expand All @@ -78,4 +82,4 @@ Raven.showReportDialog({
eventId: 'abcdef123456'
});

Raven.setDSN('https://public@sentry.io/2');
Raven.setDSN('https://public@sentry.io/2');
4 changes: 4 additions & 0 deletions typescript/raven.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ declare module Raven {
/** By default, Raven captures as many as 100 breadcrumb entries. If you find this too noisy, you can reduce this number by setting maxBreadcrumbs. Note that this number cannot be set higher than the default of 100. */
maxBreadcrumbs?: number;

/** A function that allows filtering or mutating breadcrumb payloads. Return false to throw away the breadcrumb. */
breadcrumbCallback?: (data: any) => any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be any->boolean? we don't generally care about correctness with these right? i'm afraid people will return undefined by accident and throw everything away

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeeeeah, it's kinda confusing now. You have to return either payload (an object) or a falsy value to throw it away. This is how we already annotate dataCallback, therefore I kept the pattern here.


/**
* A sampling rate to apply to events. A value of 0.0 will send no events, and a value of 1.0 will send all events (default).
*/
Expand Down Expand Up @@ -283,6 +286,7 @@ declare module Raven {
console?: boolean;
dom?: boolean;
location?: boolean;
sentry?: boolean;
}

type LogLevel = "critical" | "error" | "warning" | "info" | "debug";
Expand Down