Skip to content

Fixes Issue #5646 (httpGet() not showing friendly error message) #5647

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

reejuBhattacharya
Copy link
Contributor

Resolves #5646

Changes:
Modified the httpGet() method to show Friendly Error Message when an error is thrown

Screenshots of the change:

Before:
image

After:
image

PR Checklist

  • npm run lint passes

@reejuBhattacharya
Copy link
Contributor Author

@limzykenneth @stalgiag Would love it if you would take a look at my PR. Thanks!

@limzykenneth
Copy link
Member

I don't usually review FES stuff as I'm not as familiar with it but why is the implementation of httpGet modified here?

@reejuBhattacharya
Copy link
Contributor Author

@limzykenneth
httpGet() was directly calling the httpDo() method using apply without making a call to the p5._friendlyFileLoadError() method, which generates the FES. I modified the implementation (similiar to how loadJSON and loadStrings are implemented) so that in the event of an error, p5._friendlyFileLoadError() is called, and then passes onto the users errorCallBack.

@limzykenneth
Copy link
Member

If the idea is to patch in FES to httpGet, it would be easier to do it in httpDo itself otherwise we will need to apply the same patch to httpPost and httpDo separately.

@reejuBhattacharya
Copy link
Contributor Author

reejuBhattacharya commented Mar 27, 2022

I had the same idea at first tbh, However, httpDo() is used by all the IO functions to make requests, almost all of which already handles FES individually. Modifying httpDo() would mean modifying all the other IO functions as well to suit the changes.
Therefore, I leant towards modifying only httpGet() and subsequently httpPost() to show their own individual FES message.

@Qianqianye Qianqianye requested a review from almchung July 3, 2022 22:16
@Qianqianye Qianqianye added this to the 1.5.0 milestone Jul 3, 2022
@almchung
Copy link

almchung commented Jul 4, 2022

Hi @reejuBhattacharya, thank you for taking your time to look into this issue! I can imagine people may benefit from the added error message. Although, I have some concerns about adding the httpGet() friendly error message.

  1. err_name_not_resolved is used to describe a number of different underlying causes, and it may not be resolved via following a simple step. If we wish to be helpful, (1) we can consider linking a reliable and "friendly" resource for this error or (2) explain the situation a bit more and provide good search keywords so people can look up resources by themselves. This one is tricky!
  2. I also agree that it would be cleaner (avoid duplicated codes) to do error handling of httpGet() and httpPost() through httpDo().

Please let me know if you have any questions or concerns!

@Qianqianye
Copy link
Contributor

Thank you @reejuBhattacharya for working on it. I am wondering if you might have thoughts on @almchung's concerns?

@Qianqianye
Copy link
Contributor

Hi @reejuBhattacharya, we want to follow up with this pull request, and we are wondering if you could respond to @almchung's comments.

Meanwhile, I'm inviting this year's GSoC FES contributor @Ayush23Dash and mentors @nbriz and @almchung to this conversation, so we can decide how to move forward with this PR. Thanks.

@Qianqianye Qianqianye modified the milestones: 1.8.0, 1.9.0 Nov 23, 2023
@Qianqianye Qianqianye modified the milestones: 1.9.0, 1.9.1 Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

httpGet does not show FES message
4 participants