Skip to content

Handling of Formatter exceptions #113

@terinjokes

Description

@terinjokes

Some of the algorithms defined in the Formatter section can throw exceptions, depending on the input. This specification doesn't state how to handle these exceptions.

console.log("symbol: %s", Symbol.for("foo"));

In the Formatter algorithm we define how to handle the %s formatter:

If specifier is %s, let converted be the result of ToString(current).

The ToString documentation from ECMA-262 states that for Symbol input, a TypeError should be thrown. I would expect, based on the text, that this TypeError is thrown from the Console methods.

Implementations differ in their behavior here, though they do not seem throw the TypeError:

  • Chrome 59 prints: symbol: Symbol(foo)
  • Safari 10 prints: symbol: Symbol(foo)
  • Firefox 54 prints:
  • (TODO: Edge)

Metadata

Metadata

Assignees

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