10e8d5d1a6
The old RangeError.range message was confusing: RangeError (index): Invalid value: Not in range 0..2, inclusive: 9 The comma makes the message hard to parse. I've seen a number of people misinterpret "inclusive" as describing the invalid value (9) instead of acting as a modifier on the range. https://github.com/dart-lang/sdk/issues/29586 has a lot of bikeshedding about this, but in the interest of mitigating confusion sooner, I propose changing it to: RangeError (index): Invalid value: Not in inclusive range 0..2: 9 I'm intentionally trying to improve the message with minimal disruption to the structure of the error message. Although I'd much prefer that "Invalid value" and the actual value be adjacent instead of being interrupted by the explanation, such restructuring is rather non-trivial. RangeError allows the "Invalid value" message to be customized, and rearranging terms could produce even worse constructions. I also considered: RangeError (index): Invalid value: Not in range [0, 2]: 9 And while I like that that is brief and clear, I chose not to use it for people who are unfamiliar with interval notation and who might mistake it as a Dart List. Bug: https://github.com/dart-lang/sdk/issues/29586 Change-Id: I0f23b195437e4053ae5f76b5d303123979a8c9fe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146024 Commit-Queue: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>