We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The if in fetch caused the catch not working.
if
fetch
catch
client:
<button class="btn" _=" on click fetch /api/toggle/1 if it is 'on' then add .on to me else remove .on from me end catch e log e " > Toggle </button>
server: returnss a 404 page not found error.
However, the catch e log e is never triggered.
catch e log e
But if I replace the if with a log, it works.
log
<button class="btn" _=" on click fetch /api/toggle/1 log it catch e log e " > Toggle </button>
The text was updated successfully, but these errors were encountered:
believe it or not fetch() doesn't throw on a 404:
fetch()
https://stackoverflow.com/questions/38235715/fetch-reject-promise-and-catch-the-error-if-status-is-not-ok
so what's happening here is that no exception is happening. In the second example it's the log it that is printing the response.
log it
Sorry, something went wrong.
aha! So in fetch how to check the return code?
No branches or pull requests
The
if
infetch
caused thecatch
not working.What is wrong
Setup
client:
server: returnss a 404 page not found error.
Result
However, the
catch e log e
is never triggered.What is working
But if I replace the
if
with alog
, it works.The text was updated successfully, but these errors were encountered: