Skip to content

Commit c110853

Browse files
authored
Merge pull request #71 from lightpanda-io/module-err
module: check evaluation result
2 parents 6f1ee74 + 240140e commit c110853

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/v8.zig

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,11 +1913,15 @@ pub const Module = struct {
19131913
///
19141914
/// If IsGraphAsync() is false, the returned Promise is settled.
19151915
pub fn evaluate(self: Self, ctx: Context) !Value {
1916-
if (c.v8__Module__Evaluate(self.handle, ctx.handle)) |res| {
1917-
return Value{
1918-
.handle = res,
1919-
};
1920-
} else return error.JsException;
1916+
const res = c.v8__Module__Evaluate(self.handle, ctx.handle) orelse return error.JsException;
1917+
1918+
if (self.getStatus() == .kErrored) {
1919+
return error.JsException;
1920+
}
1921+
1922+
return Value{
1923+
.handle = res,
1924+
};
19211925
}
19221926

19231927
pub fn getIdentityHash(self: Self) u32 {

0 commit comments

Comments
 (0)