Skip to content

Commit 9670111

Browse files
pilaodaclaude
andcommitted
(test): handle non-Error thrown values in executeJs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7579194 commit 9670111

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

test/util.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,11 @@ end)());`;
557557
result = vm.runInContext(this.getJsCodeWithWrapper(), globalContext);
558558
} catch (error) {
559559
const hasMessage = (error: any): error is { message: string } => error.message !== undefined;
560-
assert(hasMessage(error));
561-
return new ExecutionError(error.message);
560+
if (hasMessage(error)) {
561+
return new ExecutionError(error.message);
562+
} else {
563+
return new ExecutionError(String(error));
564+
}
562565
}
563566

564567
function removeUndefinedFields(obj: any): any {

0 commit comments

Comments
 (0)