Skip to content

Commit b723539

Browse files
committed
Better error messages
1 parent 55db2cc commit b723539

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

apps/backend/src/lib/freestyle.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ export class TracedFreestyleSandboxes {
1717
'freestyle.nodeModules.count': options?.nodeModules ? Object.keys(options.nodeModules).length.toString() : '0',
1818
}
1919
}, async () => {
20-
return await this.freestyle.executeScript(script, options);
20+
try {
21+
return await this.freestyle.executeScript(script, options);
22+
} catch (error) {
23+
captureError("freestyle.executeScript", error);
24+
throw new StackAssertionError("Error executing script with Freestyle! " + errorToNiceString(error), { cause: error });
25+
}
2126
});
2227
}
2328
}

packages/stack-shared/src/utils/promises.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ export function runAsynchronously(
340340
promiseOrFunc?.catch(error => {
341341
options.onError?.(error);
342342
const newError = new StackAssertionError(
343-
"Uncaught error in asynchronous function: " + error.toString(),
343+
"Uncaught error in asynchronous function: " + errorToNiceString(error),
344344
{ cause: error },
345345
);
346346
concatStacktraces(newError, duringError);

0 commit comments

Comments
 (0)