You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
V8 doesn't have brand checks for the different subclasses of Error; there's only one brand that can be checked with v8::IsNativeError. So instead of JsTypeError, JsReferenceError, etc, there should just be one JsError that has factory methods for constructing the different subclasses, like JsError::type_error() and JsError::throw_type_error(), JsError::reference_error() and JsError::throw_reference_error(), etc.
There are only a fixed set of Error classes, because even though V8 offers the `Error.captureStackTrace` API for decorating an object with Error-like properties, `IsNativeError` still reports `false` for such an object. So there's really no way with V8 to create custom subclasses of `Error`.
Since there's only a fixed set (and their constructors all have the same signature), they're enumerated in a concise `enum` and passed to `JsError::new` and `JsError::throw`.
V8 doesn't have brand checks for the different subclasses of Error; there's only one brand that can be checked with
v8::IsNativeError
. So instead ofJsTypeError
,JsReferenceError
, etc, there should just be oneJsError
that has factory methods for constructing the different subclasses, likeJsError::type_error()
andJsError::throw_type_error()
,JsError::reference_error()
andJsError::throw_reference_error()
, etc.Affects: #65, #66, #67, #68.
The text was updated successfully, but these errors were encountered: