Proposal: Lazy Error.message

# _ zaoqi (6 years ago)

Allow Error.prototype.message to be a Function

It is useful in this case:

browserify/commonjs-assert#47

# Jordan Harband (6 years ago)

It can already be a getter if you like, which would allow a function to compute the value on demand.

# Augusto Moura (6 years ago)

Also, there's nothing preventing subclasses of Error to return a function as message (or any other complex object). In chrome you can also reassign a function to a existing error message, I didn't tested others browsers. User interfaces/libraries can check if a message is a function or not (giving your link to commonjs-assert I assume it was your first idea)

Em sáb, 11 de mai de 2019 às 08:55, _ zaoqi <zaomir at outlook.com> escreveu: