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

Method finally

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

@inheritdoc

(onfinally?: (() => void) | null)

Source from the content-addressed store, hash-verified

100
101 /** @inheritdoc */
102 public finally<TResult>(onfinally?: (() => void) | null): PromiseLike<TResult> {
103 return new SyncPromise<TResult>((resolve, reject) => {
104 let val: TResult | any;
105 let isRejected: boolean;
106
107 return this.then(
108 value => {
109 isRejected = false;
110 val = value;
111 if (onfinally) {
112 onfinally();
113 }
114 },
115 reason => {
116 isRejected = true;
117 val = reason;
118 if (onfinally) {
119 onfinally();
120 }
121 },
122 ).then(() => {
123 if (isRejected) {
124 reject(val);
125 return;
126 }
127
128 resolve(val as unknown as any);
129 });
130 });
131 }
132
133 /** Excute the resolve/reject handlers. */
134 private _executeHandlers(): void {

Callers

nothing calls this directly

Calls 2

thenMethod · 0.95
resolveFunction · 0.70

Tested by

no test coverage detected