Lambda saysThrow errors with throw; create meaningful ones by extending the Error class.
throw new Error("message") signals a problem and unwinds to the nearest catch. Throw Error objects (not strings) so you get a stack trace. Define custom types by extending Error (class ValidationError extends Error) so callers can catch and branch on the kind of failure.
Power-ups you unlock
throw new Error("msg") signals failure
Throw Error objects, not strings
Extend Error for custom, catchable types
Set err.name for clearer logs
The Mutator attacks — common mistakes
Throwing strings (no stack trace)
Catching a generic Error when a specific type would help
Throwing for normal control flow
Boss battleDefine a custom error class and throw it, then catch and read its name.