Skip to content

App crashes trying to redefine message getter on the thrown Error if the error already contains the message as getter #16146

@mifopen

Description

@mifopen

Describe the bug

E.g. it's impossible to run Zod validations on client because in the new versions Zod reimplemented errors and using calculable message property now.

Reproduction

Throw an object inherited from Error and with message field defined as getter property.

Logs

TypeError: Cannot redefine property: message
    at defineProperty (<anonymous>)
    at handle_error (.../node_modules/.vite/deps/...)

System Info

-

Severity

blocking all usage of svelte

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterneeds a reproduction, or clarification

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions