Skip to content

Commit fc204d5

Browse files
authored
misc: Warn user when beforeSend doesnt return an event or null (#1635)
1 parent eba209f commit fc204d5

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

CHANGELOG.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@
22

33
## Unreleased
44

5-
- [all] ref: Use Mocha v4 instead of v5, as it's not supporting IE10
6-
- [hub] Scope level overwrites level on the event
75
- [hub] fix: Scope level overwrites level on the event
8-
- [utils] ref: implemented includes, assign and isNaN polyfills
9-
- [core] ref: Check for node-env first and return more accurate global object
10-
- [core] ref: Remove Repo interface and repos attribute from Event
11-
- [core] feat: getRequestheaders should handle legacy DSNs
126
- [core] fix: correct sampleRate behaviour
137
- [core] feat: RewriteFrames pluggable integration
8+
- [core] feat: Introduce stringify and debugger options in Debug integration
9+
- [core] feat: getRequestheaders should handle legacy DSNs
10+
- [core] ref: Check for node-env first and return more accurate global object
11+
- [core] ref: Remove Repo interface and repos attribute from Event
1412
- [core] ref: Check for node-env first and return more accurate global object
1513
- [core] ref: Remove Repo interface and repos attribute from Event
1614
- [core] ref: Rewrite RequestBuffer using Array instead of Set for IE10/11
17-
- [core] feat: Introduce stringify and debugger options in Debug integration
18-
- [browser] ref: Include md5 lib and transcript it to TypeScript
15+
- [core] misc: Warn user when beforeSend doesnt return an event or null
16+
- [browser] fix: Change loader to use getAttribute instead of dataset
17+
- [browser] fix: Remove trailing commas from loader for IE10/11
1918
- [browser] feat: Better mechanism detection in TraceKit
19+
- [browser] ref: Include md5 lib and transcript it to TypeScript
2020
- [browser] ref: Remove default transaction from browser
2121
- [browser] ref: Include md5 lib and transcript it to TypeScript
22-
- [browser] test: Run integration tests on SauceLabs
23-
- [browser] test: Fix all integration tests in IE10/11 and Android browsers
2422
- [browser] ref: Remove redundant debug.ts file from browser integrations
2523
- [browser] ref: Remove all trailing commas from integration tests cuz IE10/11
26-
- [browser] fix: Change loader to use getAttribute instead of dataset
27-
- [browser] fix: Remove trailing commas from loader for IE10/11
24+
- [browser] test: Run integration tests on SauceLabs
25+
- [browser] test: Fix all integration tests in IE10/11 and Android browsers
2826
- [browser] test: Store breadcrumbs in the global variable in integration tests
2927
- [browser] test: Update polyfills for integration tests
3028
- [browser] test: Stop running raven-js saucelabs tests in favour of @sentry/browser
3129
- [node] feat: Transactions handling for RequestHandler in Express/Hapi
3230
- [node] feat: Allow requestHandler to be configured
3331
- [node] feat: Make node transactions a pluggable integration with tests
32+
- [utils] ref: implemented includes, assign and isNaN polyfills
33+
- [build] ref: Use Mocha v4 instead of v5, as it's not supporting IE10
3434

3535
## 4.0.6
3636

packages/core/src/baseclient.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { truncate } from '@sentry/utils/string';
1515
import { BackendClass } from './basebackend';
1616
import { Dsn } from './dsn';
1717
import { Backend, Client, Options } from './interfaces';
18+
import { logger } from './logger';
1819

1920
/** JSDoc */
2021
interface ExtensibleConsole extends Console {
@@ -368,6 +369,9 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
368369
const isInternalException = hint && hint.data && (hint.data as { [key: string]: any }).__sentry__ === true;
369370
if (!isInternalException && beforeSend) {
370371
finalEvent = await beforeSend(prepared, hint);
372+
if ((typeof finalEvent as any) === 'undefined') {
373+
logger.error('`beforeSend` method has to return `null` or a valid event');
374+
}
371375
}
372376
} catch (exception) {
373377
forget(

0 commit comments

Comments
 (0)