-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zig: make JSValue.toBunString use JSError #15295
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot merge this without tests that verify these bindings work.
@@ -1106,7 +1106,7 @@ pub const JestPrettyFormat = struct { | |||
defer message_string.deref(); | |||
|
|||
if (value.fastGet(this.globalThis, .message)) |message_prop| { | |||
message_string = message_prop.toBunString(this.globalThis); | |||
message_string = message_prop.toBunString(this.globalThis) catch bun.String.static("(threw exception creating message)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this exception be cleared?
@@ -328,7 +326,7 @@ pub const WebWorker = struct { | |||
var vm = this.vm orelse return; | |||
if (vm.log.msgs.items.len == 0) return; | |||
const err = vm.log.toJS(vm.global, bun.default_allocator, "Error in worker"); | |||
const str = err.toBunString(vm.global); | |||
const str = err.toBunString(vm.global) catch bun.String.static("(threw exception creating message)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this exception be cleared?
|
||
var preloads = std.ArrayList([]const u8).initCapacity(bun.default_allocator, preload_modules_len) catch bun.outOfMemory(); | ||
for (preload_modules) |module| { | ||
const utf8_slice = module.toUTF8(bun.default_allocator); | ||
defer utf8_slice.deinit(); | ||
if (resolveEntryPointSpecifier(parent, utf8_slice.slice(), error_message, &temp_log)) |preload| { | ||
if (resolveEntryPointSpecifier(parent, utf8_slice.slice(), error_message, &temp_log) catch return null) |preload| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caller cannot differentiate error.OutOfMemory and error.JSError
const path = resolveEntryPointSpecifier(parent, spec_slice.slice(), error_message, &temp_log) orelse { | ||
return null; | ||
}; | ||
const path = (resolveEntryPointSpecifier(parent, spec_slice.slice(), error_message, &temp_log) catch return null) orelse return null; | ||
|
||
var preloads = std.ArrayList([]const u8).initCapacity(bun.default_allocator, preload_modules_len) catch bun.outOfMemory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memory leak if line 206 returns.
progress towards #15141