Perry version: origin/main @ a674b6e (v0.5.1167)
Platform: macOS arm64 (Darwin 25.5)
Build/run: perry repro.ts -o out && ./out
Baseline: node --experimental-strip-types repro.ts
(Found via an internal worst-case stress suite.)
Bug
A subclass of Error that forwards options via super(message, options) loses the cause — this.cause is undefined afterward. A plain new Error(msg, { cause }) (no subclass) works, so the option is dropped specifically when passed up through super(...).
Repro
class AppError extends Error {
constructor(msg: string, opts?: ErrorOptions) { super(msg, opts); this.name = "AppError"; }
}
const e = new AppError("high-level", { cause: new TypeError("low-level") });
console.log(e.message, (e.cause as Error)?.message);
Expected (Node)
Actual (Perry)
Perry version:
origin/main@ a674b6e (v0.5.1167)Platform: macOS arm64 (Darwin 25.5)
Build/run:
perry repro.ts -o out && ./outBaseline:
node --experimental-strip-types repro.ts(Found via an internal worst-case stress suite.)
Bug
A subclass of
Errorthat forwards options viasuper(message, options)loses thecause—this.causeisundefinedafterward. A plainnew Error(msg, { cause })(no subclass) works, so the option is dropped specifically when passed up throughsuper(...).Repro
Expected (Node)
Actual (Perry)