Skip to content

Error object property "name" should be writable #144

Description

@lll000111

I give Error objects names (i.e. setting nameproperty, sometimes replacing an existing message property too) because I prefer this over sub-classing Errors, which only is simple on ES 2015 and with a functional style I don't have a single "class", "this", "bind" in any of my code, it's "just functions".

This is perfectly legal JS. It should just be a normal object.

Code

const e = new Error('test');
e.name = 'TestError';
trace(e.name + ' ' + e.message);

Result

Error: set name: not writable!

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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