Files
scriptc/tests/corpus/2095-js-catch-unknown.js
Chris Tate 6b6445ab90 Retire the "DOM" nickname in comments, internal docs, and message prose: the checked-dynamic tree / dyn values
- The ratified rename rider (world-unification §7 lane 5): "DOM" collided with the browser DOM and, post-lane-1, the structure is no longer a document tree. Comments and doc prose now say "the checked-dynamic tree" for the noun and "dyn" adjectivally; runtime symbol names (scr_dyn_*), the error.domClone libCall, and the real web DOMException family are unchanged.
- The few user-facing strings carrying the nickname move with it (the structuredClone cyclic message, the dc subscriber/publish fences, two emitter ICE texts); diagnostics snapshots regenerated (96 pass). One private compiler constant (DOM_PROTO_METHOD_NAMES -> DYN_PROTO_METHOD_NAMES) rides along.
- Mechanical sweep, 142 files, comments/prose only — no behavior change.
2026-07-24 11:14:58 -05:00

42 lines
944 B
JavaScript

// JS catch variables under useUnknownInCatchVariables: a JS catch clause
// cannot annotate its variable, so the "'e' is of type 'unknown'" demand
// joins the JS relaxation — the value stays unknown and rides the
// checked-dynamic tree at its uses (member reads, String()), the suite's
// dominant catch shape (assert error-path tests).
'use strict';
try {
throw new Error('boom');
} catch (e) {
console.log(e.message);
console.log(e.name);
console.log(String(e));
}
function thrower(kind) {
if (kind === 'type') {
throw new TypeError('wrong kind');
}
throw new RangeError('out of range');
}
try {
thrower('type');
} catch (err) {
console.log(err.name);
console.log(typeof err.message);
}
try {
thrower('range');
} catch (err) {
console.log(`${err.name}: ${err.message}`);
}
// Non-Error throws land as their own values, like Node.
try {
throw 'plain string';
} catch (e) {
console.log(typeof e, e);
}