zig: align fromJS methods to using JSError (#15165)

This commit is contained in:
Meghan Denny
2024-11-15 22:14:18 -08:00
committed by GitHub
parent 39d8ade27c
commit befb269b2d
30 changed files with 481 additions and 785 deletions

View File

@@ -714,14 +714,15 @@ pub const String = extern struct {
}
}
pub fn fromJSRef(value: bun.JSC.JSValue, globalObject: *JSC.JSGlobalObject) String {
pub fn fromJSRef(value: bun.JSC.JSValue, globalObject: *JSC.JSGlobalObject) bun.JSError!String {
JSC.markBinding(@src());
var out: String = String.dead;
if (BunString__fromJSRef(globalObject, value, &out)) {
return out;
} else {
return String.dead;
bun.assert(globalObject.hasException());
return error.JSError;
}
}