Skip to content
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

could not parse: `' (input does not start with a digit) #96

Closed
picca opened this issue Oct 15, 2019 · 1 comment
Closed

could not parse: `' (input does not start with a digit) #96

picca opened this issue Oct 15, 2019 · 1 comment

Comments

@picca
Copy link

picca commented Oct 15, 2019

Hello,
I try to use a webform with a Maybe Float

but I get this error message when it tries to parse the parameter resolution.

here the request from servant

Oct 15 11:33:38 process2 autoprocessing-exe[171261]: POST /xdsme
Oct 15 11:33:38 process2 autoprocessing-exe[171261]:   Params: [("dataCollectionId","0"),("resolution",""),("optimize","0"),("celll",""),("spacegroup","")]
Oct 15 11:33:38 process2 autoprocessing-exe[171261]:   Request Body: dataCollectionId=0&resolution=&optimize=0&celll=&spacegroup=
Oct 15 11:33:38 process2 autoprocessing-exe[171261]:   Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Oct 15 11:33:38 process2 autoprocessing-exe[171261]:   Status: 400 Bad Request 0.0003s
could not parse: `' (input does not start with a digit)

Indeed "" is not a float, but in that case I expect Nothing.

So where is the problem ?

@phadej
Copy link
Collaborator

phadej commented Oct 15, 2019

Won't fix.

In servant:

  • the Maybe indicate the absence of QueryParam.
  • you should
    • either use a newtype to special case "" case (which isn't valid Int)
    • use QueryParam' '[Optional, Lenient] so you'll get Maybe (Either Text a) and then you can do parsing choices in the hander.

@phadej phadej closed this as completed Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants