diff options
author | 2022-04-01 23:36:14 -0700 | |
---|---|---|
committer | 2022-04-01 23:36:14 -0700 | |
commit | c657c7b84639854d49d15a3d1609b81a7f1914d6 (patch) | |
tree | 361fac56b6e6cd55124b602c1584df53628e4a36 /src | |
parent | eaf09310cd30016ead450ecb10294809c9996c6b (diff) | |
download | bun-c657c7b84639854d49d15a3d1609b81a7f1914d6.tar.gz bun-c657c7b84639854d49d15a3d1609b81a7f1914d6.tar.zst bun-c657c7b84639854d49d15a3d1609b81a7f1914d6.zip |
Add helper for checking if value is an exception
Diffstat (limited to 'src')
-rw-r--r-- | src/javascript/jsc/bindings/bindings.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/javascript/jsc/bindings/bindings.zig b/src/javascript/jsc/bindings/bindings.zig index ef4b3edfe..642ed2b4d 100644 --- a/src/javascript/jsc/bindings/bindings.zig +++ b/src/javascript/jsc/bindings/bindings.zig @@ -2448,6 +2448,12 @@ pub const JSValue = enum(u64) { pub fn isError(this: JSValue) bool { return cppFn("isError", .{this}); } + + pub fn isAnyError(this: JSValue, global: *JSGlobalObject) bool { + if (this.isEmptyOrUndefinedOrNull()) return false; + + return this.isError() or this.isException(global.vm()) or this.isAggregateError(global); + } pub fn isString(this: JSValue) bool { return cppFn("isString", .{this}); } |