On the cli, simply running ReferenceError, console, console.log and many other global objects/functions prints the full object and its properties of what the script returns instead of a short message like function: ReferenceError or global object: console.
Run console, console.log, ReferenceError on the cli
Expected behavior
Print a shorter description like function: ReferenceError or global object: console
The spec define not defineewhat to /how to print what the script returns.
Build environment (please complete the following information):
We should have a discussion on how to print the objects and errors (uncaught errors) we are not bound by the spec so we can print whatever we want!
Maybe the objects should be printed like: ObjectName { MaybeValueOrEmpty }, for example:
new String("Hello") // => String { "Hello" }
new Boolean(true) // => Boolean { true }
new UserDefinedClass() // => UserDefinedClass { }
For uncaught errors:
new TypeError(msg) // => Uncaught TypeError: msg (maybe in red)
throw "Hello"; // => Uncaught "Hello" (this is how node REPL does it)
What do you think? How can we improve it?
Additionally we could have a flag for displaying all the object properties like we do now for debugging purposes.
Sound great to me. Perhaps for uncaught Errors we could print the stack trace also? (maybe just 2-3 levels of it on the cli for brevity).
Most helpful comment
We should have a discussion on how to print the objects and errors (uncaught errors) we are not bound by the spec so we can print whatever we want!
Maybe the objects should be printed like:
ObjectName { MaybeValueOrEmpty }, for example:For uncaught errors:
What do you think? How can we improve it?