Summary
Replace raw-value throw/catch with proper Error objects that include message and stack properties.
Motivation
throw and try/catch/finally are already implemented, but exceptions are raw values with no stack trace or structured error info. Proper Error objects would greatly improve debugging and align with JS expectations.
Scope
Error constructor: new Error("message")
Error.prototype.message
Error.prototype.stack (string with stack trace)
Error.prototype.toString()
TypeError, ReferenceError, SyntaxError — use internally where appropriate
- Backward-compatible: raw-value throws should still work alongside Error objects
Out of scope
Error.captureStackTrace
AggregateError
cause property / error.cause
Summary
Replace raw-value throw/catch with proper
Errorobjects that includemessageandstackproperties.Motivation
throwandtry/catch/finallyare already implemented, but exceptions are raw values with no stack trace or structured error info. ProperErrorobjects would greatly improve debugging and align with JS expectations.Scope
Errorconstructor:new Error("message")Error.prototype.messageError.prototype.stack(string with stack trace)Error.prototype.toString()TypeError,ReferenceError,SyntaxError— use internally where appropriateOut of scope
Error.captureStackTraceAggregateErrorcauseproperty /error.cause