Skip to content

Commit

Permalink
fix(module-loader): use a more descriptive crash message (oven-sh#15831)
Browse files Browse the repository at this point in the history
Co-authored-by: Don Isaac <don@bun.sh>
Co-authored-by: DonIsaac <DonIsaac@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent b5b5100 commit e66a347
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bun.js/module_loader.zig
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const Async = bun.Async;
const String = bun.String;

const debug = Output.scoped(.ModuleLoader, true);
const panic = std.debug.panic;

inline fn jsSyntheticModule(comptime name: ResolvedSource.Tag, specifier: String) ResolvedSource {
return ResolvedSource{
Expand Down Expand Up @@ -1767,7 +1768,7 @@ pub const ModuleLoader = struct {
.specifier = input_specifier,
.source_url = input_specifier.createIfDifferent(path.text),
.hash = 0,
.jsvalue_for_export = parse_result.ast.parts.@"[0]"().stmts[0].data.s_expr.value.toJS(allocator, globalObject orelse jsc_vm.global) catch @panic("Unexpected JS error"),
.jsvalue_for_export = parse_result.ast.parts.@"[0]"().stmts[0].data.s_expr.value.toJS(allocator, globalObject orelse jsc_vm.global) catch |e| panic("Unexpected JS error: {s}", .{@errorName(e)}),
.tag = .exports_object,
};
}
Expand Down

0 comments on commit e66a347

Please sign in to comment.