Skip to content

Commit 0805563

Browse files
committed
convert SyncPromise.reject
1 parent bb5262c commit 0805563

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
@@ -23,6 +23,7 @@ import {
2323
normalize,
2424
SentryError,
2525
SyncPromise,
26+
syncPromiseReject,
2627
syncPromiseResolve,
2728
truncate,
2829
uuid4,
@@ -534,7 +535,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
534535
}
535536

536537
if (!this._isEnabled()) {
537-
return SyncPromise.reject(new SentryError('SDK not enabled, will not capture event.'));
538+
return syncPromiseReject(new SentryError('SDK not enabled, will not capture event.'));
538539
}
539540

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

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
/** A simple queue that holds promises. */
55
export class PromiseBuffer<T> {
@@ -27,7 +27,7 @@ export class PromiseBuffer<T> {
2727
*/
2828
public add(taskProducer: () => PromiseLike<T>): PromiseLike<T> {
2929
if (!this.isReady()) {
30-
return SyncPromise.reject(new SentryError('Not adding Promise due to buffer limit reached.'));
30+
return syncPromiseReject(new SentryError('Not adding Promise due to buffer limit reached.'));
3131
}
3232

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

0 commit comments

Comments
 (0)