-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quantity parser returns NaN
instead of an Error in some edge cases.
#7487
Comments
By error, do you mean returning a ParseError? We also still have the split between throwing a QuantityError and returning (not throwing) a ParseError. |
Hi, Im not sure which parsing got used here. Currently there are 2 parsing methods in Parser.ts, the async they both use The problem with returning an error on async parseIntoQuantity is that it returns a
it doesnt contain info on what the ParseError is. It does tell whether the returned Quantity is valid. (it did in the call stack calls Maybe we can change the return type of the async method to match with the sync one. The sync one returns a
After the fix in the pr, the sync method returns Im just not sure how this might affect things cause its changing the return type of a public api. |
Note, I'm not 100% certain that it returns NaN. When an error is returned, the AccuDraw input field handles it correctly, it ignores the value and uses another valid one. |
When parsing two dots
..
or two comas,,
the length formatter returnNaN
instead of an error.I am parsing using the engineering length parser, in imperial.
I suggest that whenever we parse a
NaN
value, we convert the result to an error instead.The text was updated successfully, but these errors were encountered: