-
Notifications
You must be signed in to change notification settings - Fork 22
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
Vanilla: Call onError without argument if there is no response #9
Conversation
ping @soenkehahn |
|
Ok, I am pretty sure this can be improved. My reasoning is that if JSON is served, it should be valid - this PR only treats the case of no response. But I am still not sure about what is desired here:
|
My concerns are that in not |
I updated the patch |
src/Servant/JS/Vanilla.hs
Outdated
<> " var value = JSON.parse(xhr.responseText);\n" | ||
<> " onError(value);\n" | ||
<> " try { res = JSON.parse(xhr.responseText); } catch (e) { " <> onError <> "(e); }\n" | ||
<> " if (res) " <> onSuccess <> "(res);\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onSuccess
, it should be onError
?
ouch yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll try it and merge then. Thanks.
See haskell-servant/servant#607