We're updating the issue view to help you get more done. 

NumberFormatter: move all error codes to the final terminal method?

Description

In the @draft API, the error code is passed to the format method.

1 NumberFormatter.withLocale("en").formatInt(123, status).toString()

There is no error code in the toString(). However, to be more future-proof, we should consider moving the error code from format method to the toString() method.

1 NumberFormatter.withLocale("en").formatInt(123).toString(status)

One example of an edge case that should probably set the error code, but doesn't do so because there is no error code in the toString() method, is if you try calling toString() on an invalid FormattedNumber instance, such as one that was created without data.

Moving the error code would also make the design more future-proof, if, for example, the code were refactored such that "heavy-lifting" didn't start occurring until the terminal method.

Status

Assignee

Shane Carr

Reporter

Shane Carr

Labels

Reviewer

None

Time Needed

None

Start date

None

Components

Fix versions

Priority

major