Skip to content

Commit 29794af

Browse files
committed
convert SyncPromise.reject
1 parent 6970ee1 commit 29794af

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/core/src/baseclient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
normalize,
2222
SentryError,
2323
SyncPromise,
24+
syncPromiseReject,
2425
syncPromiseResolve,
2526
truncate,
2627
uuid4,
@@ -532,7 +533,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
532533
}
533534

534535
if (!this._isEnabled()) {
535-
return SyncPromise.reject(new SentryError('SDK not enabled, will not capture event.'));
536+
return syncPromiseReject(new SentryError('SDK not enabled, will not capture event.'));
536537
}
537538

538539
const isTransaction = event.type === 'transaction';
@@ -541,7 +542,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
541542
// Sampling for transaction happens somewhere else
542543
if (!isTransaction && typeof sampleRate === 'number' && Math.random() > sampleRate) {
543544
recordLostEvent('sample_rate', 'event');
544-
return SyncPromise.reject(
545+
return syncPromiseReject(
545546
new SentryError(
546547
`Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,
547548
),

packages/utils/src/promisebuffer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SentryError } from './error';
2-
import { SyncPromise } from './syncpromise';
2+
import { SyncPromise, syncPromiseReject } from './syncpromise';
33

44
function allPromises<U = unknown>(collection: Array<U | PromiseLike<U>>): PromiseLike<U[]> {
55
return new SyncPromise<U[]>((resolve, reject) => {
@@ -48,7 +48,7 @@ export class PromiseBuffer<T> {
4848
*/
4949
public add(taskProducer: () => PromiseLike<T>): PromiseLike<T> {
5050
if (!this.isReady()) {
51-
return SyncPromise.reject(new SentryError('Not adding Promise due to buffer limit reached.'));
51+
return syncPromiseReject(new SentryError('Not adding Promise due to buffer limit reached.'));
5252
}
5353

5454
// start the task and add its promise to the queue

0 commit comments

Comments
 (0)