MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / then

Method then

packages/core/src/utils/syncpromise.ts:58–92  ·  view source on GitHub ↗

@inheritdoc

(
    onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
    onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
  )

Source from the content-addressed store, hash-verified

56
57 /** @inheritdoc */
58 public then<TResult1 = T, TResult2 = never>(
59 onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
60 onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
61 ): PromiseLike<TResult1 | TResult2> {
62 return new SyncPromise((resolve, reject) => {
63 this._handlers.push([
64 false,
65 result => {
66 if (!onfulfilled) {
67 // TODO: ¯\_(ツ)_/¯
68 // TODO: FIXME
69 resolve(result as any);
70 } else {
71 try {
72 resolve(onfulfilled(result));
73 } catch (e) {
74 reject(e);
75 }
76 }
77 },
78 reason => {
79 if (!onrejected) {
80 reject(reason);
81 } else {
82 try {
83 resolve(onrejected(reason));
84 } catch (e) {
85 reject(e);
86 }
87 }
88 },
89 ]);
90 this._executeHandlers();
91 });
92 }
93
94 /** @inheritdoc */
95 public catch<TResult = never>(

Callers 15

catchMethod · 0.95
finallyMethod · 0.95
patchWebAssemblyFunction · 0.45
_sendProfileChunkMethod · 0.45
utils.tsFile · 0.45
onProfileHandlerFunction · 0.45
profilingWrappedSpanEndFunction · 0.45
setupSidecarForwardingFunction · 0.45
createStoreFunction · 0.45
pushFunction · 0.45
unshiftFunction · 0.45

Calls 3

_executeHandlersMethod · 0.95
pushMethod · 0.80
resolveFunction · 0.70