BioDrop: [BUG] needs proper error handling in manage form section
Description
We have lots of AJAX call in pages/account/manage section and we are calling fetch() function. The problem is here that by default the fetch function doesn’t reject the promise if we get back an error status code, in that case, we should reject the promise and throw an actual error and handle the rejected promise.
The downside of not handling a rejected promise in fetch call is that if the request fails for any reason, such as a network error or server-side error, the code does not handle the error gracefully. As a result, the application may not provide appropriate feedback or error handling to the user.
Without proper error handling, it becomes challenging to identify the cause of the issue. Debugging the code and fixing the problem becomes more complex, as there is no specific error message or indication of what went wrong.
To address this issue, it is important to handle rejected promises appropriately. This can involve displaying error messages to the user.
Screenshots
No response
Additional information
want to fix this issue
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (17 by maintainers)
I will ask the other maintainers to take a look, I don’t see a big benefit, it looks very much the same to me and focused on form validation - so wouldn’t work for other http requests 🤔
I think the part we could use is wrapping the http request in a
try/catchI think you should need to know how
promiseworks. (note: please don’t comment issues that are unrelated as this creates extra noise and confusion)If you need any help- EddieHub Discord might be better https://discord.gg/44dXjyWB
Thanks @badrivlog sure I will take a look and ask the maintainers to also as this is a challenging topic 👍
But part of that code is specific to form validation and not other requests
Yes we use
async/awaitin our project and we are keen to keep things consistent 👍 thanks for the collaboration everyone, great to see different perspectives 💪@badrivlog that looks good 👍 I will assign it to you