DeadContext handling#39
Merged
mxsnq merged 4 commits intoispras:masterfrom Dec 8, 2023
MatthewZMSU:master
Merged
Conversation
mxsnq
reviewed
Nov 24, 2023
Comment on lines
+23
to
29
| } else { // No context. Possibly, our service was restarted | ||
| res.status(422); | ||
|
|
||
| res.send({ | ||
| error: errorMessage | ||
| }); | ||
| } |
Member
There was a problem hiding this comment.
It works well, but I'm not sure we should treat every error outside action calls as 422. For example, if a context/page creation fails, it is a server issue and we might want to reply with 500+. Maybe we should reply with 422 only on "context/page not found" errors? We can create a custom error type for that.
helpers/middlewares.js
Outdated
|
|
||
| if (contextId) { | ||
| res.header('scrapy-puppeteer-service-context-id', contextId); | ||
| } // What if contextId is undefined? Maybe we should skip such situations... |
mxsnq
approved these changes
Nov 24, 2023
Now we response with not only 422 but also with 500
Contributor
Author
|
Now we recognise _Page/Conext_NotFound errors, but we still do not recognize e.g. "Error: No element found for selector" as client's error (we treat this as 500). May be this is future work. |
set status and send response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added handling the no-context exception, so now in Scrapy-puppeteer we do not Retry 3 times the same page and context.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Tested manually with Scrapy spider
Tested with Scrapy-puppeteer auto-tests
My code follows the style guidelines of this project
I have performed a self-review of my code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation
My changes generate no new warnings