ITADN

Displayed error modals when connection to server fails

#176Pull RequestMounayer 创建于 2024-10-14
M
Mounayercommented
## Description Closes #172 Using the already existing modal component, I have covered two edge cases when an error happens, and nothing is displayed to the user. ### First case If the user goes to their room and clicks on the QR code button quickly, before the `Connection closed` modal pops up, they are presented with the modal that displays the QR code, with a broken image of the QR code, since there's no connection to the server. I simply added an onError listener to the `img` element, that now clearly displays an error modal with information to the user, i.e.: ![image](https://github.com/user-attachments/assets/cdb33617-88ba-41dd-a9f4-faac0382b8c9) instead of just: ![image](https://github.com/user-attachments/assets/b52f873a-84cb-4959-965b-d2e000b8c833) ### Second case If the connection to the server is failing, we are unable to load the local peers, this failure is not being displayed to the user in any way. A simple modal is now being displayed when the peers are failing to load to the user, asking them to check their internet connection! i.e.: ![image](https://github.com/user-attachments/assets/cd0c2acd-4f09-48c1-910e-e392abc5fb12) Whereas before, while peers fail to load, no errors were being displayed at all. ## Testing - Test by running the `client` without the `server`, go to `localhost:8080/app`, you should have an error modal pop up telling you what the issue is. - Test by running the `client` without the `server`, go to `localhost:8080/app`, and try to go to the `local network room` really quick before the error modal pops up, and continue to quickly click on the `QR` button, that displays the modal which displays the `QR` code. You should not get an error message when it fails to retrieve the proper `QR` code from the server. Please let me know if there are any suggestion or requested changes, I'd be glad to apply them!
合并状态:未合并 5 条评论