Skip to content

dynamic new <class-value>(args) drops all args when the class has an implicit default constructor — every effect error loses its message #6469

Description

@proggeramlug

Summary

A function-nested class extending an Error-descendant, with no explicit constructor, drops the arguments passed to new — the implicit derived constructor fails to forward them to super(...). Every error built through effect's makeException factory therefore has message === undefined, and every failure in an effect app prints as "An error has occurred" instead of its real message (e.g. the web.ts startup failure surfaces as a message-less RuntimeException, hiding whatever dieMessage(...) text node would show).

Minimal repro

class Y extends Error {}

const make2 = (): any => {
  class Plain extends Y {}          // no captures, no statics, no ctor
  return Plain
}
const P2 = make2()
console.log(new P2("direct").message)   // node: "direct" | perry: undefined

Matrix (probe40, node → perry)

case node perry
implicit ctor, nested class w/ captured field (new A("boom")) "boom" undefined
implicit ctor, nested class, no captures (new P2("direct")) "direct" undefined
implicit ctor, class expression w/ capture (new C3("expr-msg")) "expr-msg" undefined
explicit constructor(msg?){ super(msg) } + capture "explicit" "explicit"

The explicit-forwarding case works, so the defect is specifically the synthesized default derived constructor (spec: constructor(...args) { super(...args) }) not forwarding args — at least for classes whose base chain reaches the native Error.

Impact

Found while unmasking the web.ts startup failure: with the #6465 per-evaluation fix applied, the real error is a RuntimeException whose message was dropped by this bug — the actual failure text is still unknown until this is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions