mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 19:08:50 +00:00
Clean up some error handling code (#15368)
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
This commit is contained in:
@@ -706,10 +706,14 @@ pub const String = extern struct {
|
||||
pub fn fromJS2(value: bun.JSC.JSValue, globalObject: *JSC.JSGlobalObject) bun.JSError!String {
|
||||
var out: String = String.dead;
|
||||
if (BunString__fromJS(globalObject, value, &out)) {
|
||||
bun.assert(out.tag != .Dead);
|
||||
if (comptime bun.Environment.isDebug) {
|
||||
bun.assert(out.tag != .Dead);
|
||||
}
|
||||
return out;
|
||||
} else {
|
||||
bun.assert(globalObject.hasException());
|
||||
if (comptime bun.Environment.isDebug) {
|
||||
bun.assert(globalObject.hasException());
|
||||
}
|
||||
return error.JSError;
|
||||
}
|
||||
}
|
||||
@@ -721,7 +725,9 @@ pub const String = extern struct {
|
||||
if (BunString__fromJSRef(globalObject, value, &out)) {
|
||||
return out;
|
||||
} else {
|
||||
bun.assert(globalObject.hasException());
|
||||
if (comptime bun.Environment.isDebug) {
|
||||
bun.assert(globalObject.hasException());
|
||||
}
|
||||
return error.JSError;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user