You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature Request: Enhance ParseQuantityError to Include Suggested Values
Problem Description
The current implementation of parseQuantityString in the Parser returns a ParseQuantityError with the following structure:
exportinterfaceParseQuantityError{/** Union discriminator for [[QuantityParseResult]]. */ok: false;/** The specific error that occurred during parsing. */error: ParseError;}
link
Current design only provides an error. It seemed a better design to suggest a possible value.
For example, with the default BaseFormat, an input like 1,..2 results in an error but also suggests a value of 1.2, that could guide users toward the correct format.
Proposed Enhancement
Include a "suggested value" in ParseQuantityError to make error handling more user-friendly. For instance:
Input: 1,..2
Current Output: Error without suggestion
Suggested Output: Error with a suggested value of 1.2
Feature Request: Enhance
ParseQuantityError
to Include Suggested ValuesProblem Description
The current implementation of
parseQuantityString
in theParser
returns aParseQuantityError
with the following structure:link
Current design only provides an error. It seemed a better design to suggest a possible value.
For example, with the default
BaseFormat
, an input like1,..2
results in an error but also suggests a value of1.2
, that could guide users toward the correct format.Proposed Enhancement
Include a "suggested value" in ParseQuantityError to make error handling more user-friendly. For instance:
Input: 1,..2
Current Output: Error without suggestion
Suggested Output: Error with a suggested value of 1.2
Use Case References
Rn this API is utilized in locations such as:
AccuDraw.ts#L1074
AccuDraw.ts#L1042
Currently, those methods only returns a value when parseResult.ok is true.
The text was updated successfully, but these errors were encountered: