8000 ref: Remove invokeClientAsync function · DanielGibbsNZ/sentry-javascript@8cdee67 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 8cdee67

Browse files
committed
ref: Remove invokeClientAsync function
1 parent 5a82777 commit 8cdee67

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

packages/hub/src/hub.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,6 @@ export class Hub {
6666
}
6767
}
6868

69-
/**
70-
* Internal helper function to call an async method on the top client if it
71-
* exists.
72-
*
73-
* @param method The method to call on the client/client.
74-
* @param args Arguments to pass to the client/frontend.
75-
*/
76-
private invokeClientAsync(method: string, ...args: any[]): void {
77-
const top = this.getStackTop();
78-
if (top && top.client && top.client[method]) {
79-
top.client[method](...args, top.scope).catch((err: any) => {
80-
logger.error(err);
81-
});
82-
}
83-
}
84-
8569
/**
8670
* Checks if this hub's version is older than the given version.
8771
*
@@ -196,7 +180,7 @@ export class Hub {
196180
*/
197181
public captureException(exception: any, hint?: SentryEventHint): string {
198182
const eventId = (this._lastEventId = uuid4());
199-
this.invokeClientAsync('captureException', exception, {
183+
this.invokeClient('captureException', exception, {
200184
...hint,
201185
event_id: eventId,
202186
});
@@ -213,7 +197,7 @@ export class Hub {
213197
*/
214198
public captureMessage(message: string, level?: Severity, hint?: SentryEventHint): string {
215199
const eventId = (this._lastEventId = uuid4());
216-
this.invokeClientAsync('captureMessage', message, level, {
200+
this.invokeClient('captureMessage', message, level, {
217201
...hint,
218202
event_id: eventId,
219203
});
@@ -228,7 +212,7 @@ export class Hub {
228212
*/
229213
public captureEvent(event: SentryEvent, hint?: SentryEventHint): string {
230214
const eventId = (this._lastEventId = uuid4());
231-
this.invokeClientAsync('captureEvent', event, {
215+
this.invokeClient('captureEvent', event, {
232216
...hint,
233217
event_id: eventId,
234218
});

packages/node/test/transports/http.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { SentryError } from '@sentry/core';
21
import { TransportOptions } from '@sentry/types';
2+
import { SentryError } from '@sentry/utils/error';
33
import * as HttpsProxyAgent from 'https-proxy-agent';
44
import { HTTPTransport } from '../../src/transports/http';
55

packages/node/test/transports/https.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { SentryError } from '@sentry/core';
21
import { TransportOptions } from '@sentry/types';
2+
import { SentryError } from '@sentry/utils/error';
33
import * as HttpsProxyAgent from 'https-proxy-agent';
44
import { HTTPSTransport } from '../../src/transports/https';
55

0 commit comments

Comments
 (0)
0