Skip to content

Commit b20dd37

Browse files
committed
Fix fetch binding, prepareStackTrace undefined
1 parent d50522e commit b20dd37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ interface CallSite {
2929
* Parse a stack trace from
3030
*/
3131
export function getErrorStack(error: Error): CallSite[] {
32-
const prepareStackTrace = Error.prepareStackTrace!;
32+
const prepareStackTrace = Error.prepareStackTrace;
3333
let trace: CallSite[];
3434

3535
Error.prepareStackTrace = (error, v8Trace) => {
3636
trace = v8Trace as CallSite[];
37-
return prepareStackTrace(error, v8Trace);
37+
return prepareStackTrace?.(error, v8Trace);
3838
};
3939

4040
Error.captureStackTrace(error, getErrorStack);
@@ -82,7 +82,7 @@ export class Sentry {
8282

8383
constructor(options: SentryOptions) {
8484
this.sentryUrl = new URL(options.dsn);
85-
this.fetch = options.fetch || fetch;
85+
this.fetch = options.fetch || fetch.bind(null);
8686
}
8787

8888
/**

0 commit comments

Comments
 (0)