[WIP] Fix error/zubair ali#2761
Draft
ZubairAli999 wants to merge 4 commits into
Draft
Conversation
Add richer error model and detection, tidy common error definitions, and improve notification logic in maigret/errors.py: introduce CheckError.context, implement detect() and solution_of(), simplify ERRORS_TYPES, add type hints, fix error grouping percentage calculation, and refine notify_about_errors formatting and thresholds. Update maigret/report.py to adjust imports, add an updated CSV export (new header and per-site fields including error reason and site URL), and enhance XMind sheet generation to include Errors/Undefined sections and preserve ids metadata for reported entries. Miscellaneous style/formatting cleanups across both files.
Remove obsolete/duplicated report code and add clarifying comments in errors.py. In report.py: deleted an old CSV writer block in generate_csv_report and a large duplicated XMind sheet construction block in design_xmind_sheet to reduce dead code and clutter. In errors.py: added comment headers around the threshold constant and the error analysis function to improve readability. No functional logic changes other than removing unused/duplicated report code.
The detect() function was returning CheckError for ANY non-empty text that didn't match known patterns. This caused valid 200 responses to be incorrectly marked as errors. Changed behavior: - Only return CheckError if a known error pattern is found - Return None for normal/valid responses (including HTML bodies) This fixes all 24 failing tests that were getting "Unrecognized error pattern" for valid responses.
Author
|
PR (#2667 ) |
- Add comprehensive error solutions for Captcha, Bot protection, Access denied - Add DNS-specific error handling with proper recommendations - Add Webgate unavailable error handling with FlareSolverr instructions - Add PROXY_RECOMMENDATION constant that was missing - Fixes failing tests that expect complete error handling
Owner
|
@ZubairAli999 please, fix the tests |
Author
|
@soxoj Don’t worry, I can fix the problem. Please give me some time, I’m currently a bit busy with another project, but I’ll take care of it. |
Author
|
@soxoj The issues in report.py and error.py are fixed and their code works fine. The remaining test failures are unrelated:
|
Author
Owner
|
@ZubairAli999 please, keep only one PR for #2667. |
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.
PR (#2667)