-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add configurable Error handling for HTTP requests #1598
Comments
Hi, Probably there is a way to hit two birds with one stone, Best regards, Salim |
This might be useful, error handlers can be added to cornerstone events fired by |
@swederik Per your question on IDC Slack, it looks good to go as an IDC:Priority, but I don't believe I have permissions here to modify labels or status. Thanks. |
@JamesAPetts I don't seem to have a way to distinguish between the 429 status returned by the server and other HTTP errors; the error.status value that shows up in the handler is always equal to 0, presumably what is returned by XMLHttpRequest. I have triple-checked the server response and I am pretty sure it is sending back 429. I have only recently been able to go back and work on this. Note the idc-sandbox-002 proxy is set to trigger a 429 after about only 16MB of daily downloads. |
Hey @wlongabaugh, Looking here under XMLHttpRequest is native web api, and about as much control as we have on the client. A zero error code can come from:
As this section is wrapped in a request.readyState === 4 if block , it cannot be the first option, as state 4 is ready, this must mean its hitting an XMLHttpRequest error. I can confirm the 429 is being sent if I hit the requested series data directly in the browser When you return the 429 are you attaching the same Kind regards, |
Thanks for the quick response @JamesAPetts, I appreciate it! |
Thanks for the analysis; it is very helpful. I don't think I am attaching the headers, and will go do that. |
I have added the CORS headers to the 429 response, and a check indicates that it is getting through now. The error handler for the viewer in idc-dev is now set up to report quota exceeded only when a 429 arrives. Still need to test it with a low daily limit set up to confirm the issue can be closed. Thanks. |
@wlongabaugh are we all set with this issue - can it be closed? |
I wanted to check that the page actually triggers when the quota is hit, and was waiting to test that, but wasn't getting the chance to put a low quota in dev. But I guess you got the (crappy original) quota page yesterday already (correct?) with the actual 4GB limit in place, so yeah it does work as designed. You can close. |
For the NCI Imaging Data Commons project, users will be able to access data without logging in, but a data usage limit will be put in place to prevent users from abusing the system to directly download studies.
Once the user reaches the data usage limit, the HTTP requests to the proxy will begin returning HTTP 429 Too Many Requests. The exact behaviour we want once this has been reached is currently unknown, but it will likely be something like showing a modal or redirecting the user to the IDC homepage or a form to request more resources.
In general, though, we should be able to configure error handling at the HTTP level for all of the requests that OHIF is making to the PACS. Although this is not in scope in this ticket, for other resources we can resurrect #1434 later on.
This means we will likely need to add error handling in calls to Cornerstone's loadAndCacheImage, and possibly at the level of cornerstoneWADOImageLoader and dicomweb-client.
I can imagine this would be useful for other cases, e.g. how to handle users suddenly receiving 401 responses from PACS.
The text was updated successfully, but these errors were encountered: