Skip to content

Commit 7e087f7

Browse files
committed
refactor: streamline beforeSend and beforeBreadcrumb hook handling by renaming variables for clarity
1 parent 4279d77 commit 7e087f7

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

packages/javascript/src/addons/breadcrumbs.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,20 @@ export class BreadcrumbManager {
237237
*/
238238
if (this.options.beforeBreadcrumb) {
239239
const breadcrumbClone = structuredClone(bc);
240-
const modified = this.options.beforeBreadcrumb(breadcrumbClone, hint);
240+
const result = this.options.beforeBreadcrumb(breadcrumbClone, hint);
241241

242242
/**
243243
* false means discard
244244
*/
245-
if (modified === false) {
245+
if (result === false) {
246246
return;
247247
}
248248

249249
/**
250250
* Valid breadcrumb → apply changes from hook
251251
*/
252-
if (isValidBreadcrumb(modified)) {
253-
Object.assign(bc, modified);
252+
if (isValidBreadcrumb(result)) {
253+
Object.assign(bc, result);
254254
} else {
255255
/**
256256
* Anything else is invalid — warn, bc stays untouched (hook only received a clone)

packages/javascript/src/catcher.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,20 +439,20 @@ export default class Catcher {
439439
*/
440440
if (typeof this.beforeSend === 'function') {
441441
const eventClone = structuredClone(payload);
442-
const modified = this.beforeSend(eventClone);
442+
const result = this.beforeSend(eventClone);
443443

444444
/**
445445
* false → drop event
446446
*/
447-
if (modified === false) {
447+
if (result === false) {
448448
throw new EventRejectedError('Event rejected by beforeSend method.');
449449
}
450450

451451
/**
452452
* Valid event payload → use it instead of original
453453
*/
454-
if (isValidEventPayload(modified)) {
455-
payload = modified as HawkJavaScriptEvent;
454+
if (isValidEventPayload(result)) {
455+
payload = result as HawkJavaScriptEvent;
456456
} else {
457457
/**
458458
* Anything else is invalid — warn, payload stays untouched (hook only received a clone)

packages/javascript/src/modules/socket.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import log from '../utils/log';
22
import type { CatcherMessage } from '@/types';
3+
import type { Transport } from '../types/transport';
34

45
/**
56
* Custom WebSocket wrapper class
67
*
78
* @copyright CodeX
89
*/
9-
export default class Socket {
10+
export default class Socket implements Transport {
1011
/**
1112
* Socket connection endpoint
1213
*/

0 commit comments

Comments
 (0)