« Bugzilla Issues Index

#1663 — 15.11.1, Subclass initialisation for Error and NativeError

Error and NativeError can both be used to initialise any error subclass instances, because both initialise the [[ErrorData]] internal data property. But the current text says Error must be used to initialise Error subclasses whereas NativeError must be used to initialise NativeError subclasses.

test case:
js> class MyError extends Error {constructor(){}}
js> err = new MyError(); err ===
js> class MyTypeError extends TypeError {constructor(){}}
js> err = new MyTypeError(); err ===

fixed in rev17 editor's draft

I changed a could "musts" to "shoulds"

I think this overall behavior is probably ok. However, it may not be valid if am implementation attaches additional state to native errors (eg, a stack trace) that is not also associated with generic Error objects

fixed in rev17, August 23, 2013 draft