Skip to content

errors: make code property mutable

Rodrigo Muino Tomonari requested to merge github/fork/Trott/code-writable into master

Userland code can break if it depends on a mutable code property for errors. Allow users to change the code property but do not propagate changes to the error name.

Additionally, make message and name consistent with Error object (non-enumerable). Test that console.log() and .toString() calls on internal Error objects with mutated properties have analogous results with the standard ECMAScript Error objects.

Fixes: https://github.com/nodejs/node/issues/15658

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

errors

Merge request reports

Loading