mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
allow zig js host functions to return JSError (#15120)
This commit is contained in:
@@ -709,7 +709,8 @@ pub const String = extern struct {
|
||||
bun.assert(out.tag != .Dead);
|
||||
return out;
|
||||
} else {
|
||||
return globalObject.jsErrorFromCPP();
|
||||
bun.assert(globalObject.hasException());
|
||||
return error.JSError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1325,7 +1326,7 @@ pub const String = extern struct {
|
||||
return try concat(strings.len, allocator, strings);
|
||||
}
|
||||
|
||||
pub export fn jsGetStringWidth(globalObject: *JSC.JSGlobalObject, callFrame: *JSC.CallFrame) callconv(JSC.conv) JSC.JSValue {
|
||||
pub fn jsGetStringWidth(globalObject: *JSC.JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSC.JSValue {
|
||||
const args = callFrame.arguments(1).slice();
|
||||
|
||||
if (args.len == 0 or !args.ptr[0].isString()) {
|
||||
|
||||
Reference in New Issue
Block a user