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

@@ -330,7 +330,7 @@ pub const Tag = enum(short) {
return toJSWithType(tag, globalObject, @TypeOf(value), value);
}
pub fn fromJS(globalObject: *JSC.JSGlobalObject, value: JSValue) anyerror!Tag {
pub fn fromJS(globalObject: *JSC.JSGlobalObject, value: JSValue) bun.JSError!Tag {
if (value.isEmptyOrUndefinedOrNull()) {
return Tag.numeric;
}
@@ -359,6 +359,7 @@ pub const Tag = enum(short) {
if (tag.isArrayLike() and value.getLength(globalObject) > 0) {
return Tag.fromJS(globalObject, value.getIndex(globalObject, 0));
}
if (globalObject.hasException()) return error.JSError;
// Ban these types:
if (tag == .NumberObject) {