Skip to content

docs: Added captureUnhandledRejections and dataCallback to migration #2693

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
Jun 24, 2020
Merged
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
60 changes: 51 additions & 9 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,38 @@ _Old_:
```js
Raven.config('___PUBLIC_DSN___', {
shouldSendCallback(event) {
// Modify the event here
if(event.user){
// Only send events that include user data
if (event.user){
return true;
}
return false;
}
});
```

_New_:

```js
Sentry.init({
beforeSend(event) {
if (event.user) {
return event;
}
return null
}
});
```

### Modifying Events (`dataCallback`)

_Old_:

```js
Raven.config('___PUBLIC_DSN___', {
dataCallback(event) {
if (event.user) {
// Don't send user's email address
delete event.user.email;
} else {
return false; // don't send this event
}
return event;
}
Expand All @@ -303,12 +329,8 @@ _New_:
```js
Sentry.init({
beforeSend(event) {
// Modify the event here
if(event.user){
// Don't send user's email address
if (event.user) {
delete event.user.email;
} else {
return null; // don't send this event
}
return event;
}
Expand All @@ -334,3 +356,23 @@ Sentry.init({
attachStacktrace: true,
});
```

### Disabling Promises Handling

_Old_:

```js
Raven.config('___PUBLIC_DSN___', {
captureUnhandledRejections: false,
});
```

_New_:

```js
Sentry.init({
integrations: [new Sentry.Integrations.GlobalHandlers({
onunhandledrejection: false
})]
})
```