MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / resolve

Function resolve

packages/sveltekit/test/server-common/handle.test.ts:61–92  ·  view source on GitHub ↗
(
  type: Type,
  isError: boolean,
  throwSpecialError?: 'redirect' | 'http',
)

Source from the content-addressed store, hash-verified

59}
60
61function resolve(
62 type: Type,
63 isError: boolean,
64 throwSpecialError?: 'redirect' | 'http',
65): Parameters<Handle>[0]['resolve'] {
66 if (throwSpecialError === 'redirect') {
67 throw redirect(302, '/redirect');
68 }
69 if (throwSpecialError === 'http') {
70 throw { status: 404, body: 'Not found' };
71 }
72
73 if (type === Type.Sync) {
74 return (..._args: unknown[]) => {
75 if (isError) {
76 throw new Error(type);
77 }
78
79 return mockResponse;
80 };
81 }
82
83 return (..._args: unknown[]) => {
84 return new Promise((resolve, reject) => {
85 if (isError) {
86 reject(new Error(type));
87 } else {
88 resolve(mockResponse);
89 }
90 });
91 };
92}
93
94let client: NodeClient;
95

Callers 5

handle.test.tsFile · 0.70
instrumentHandleFunction · 0.50
resolveWithSentryFunction · 0.50
handleInitSentryFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected