Implement Error Handling in backend - T415715 Micro-Task#88
Open
Mariam22-hub wants to merge 3 commits intoindictechcom:masterfrom
Open
Implement Error Handling in backend - T415715 Micro-Task#88Mariam22-hub wants to merge 3 commits intoindictechcom:masterfrom
Mariam22-hub wants to merge 3 commits intoindictechcom:masterfrom
Conversation
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.
This PR addresses this backend improvement tasks:
Error Handling & Observability — strengthen exception handling, introduce structured logging, standardise API error responses, and capture async task errors
Key Changes
Standardized API Responses
utils.pyRequest Handling
get_json(silent=True))Consistent Error Handling
FileNotFoundOnWikiError→ 404ImageDownloadError,APIRequestError→ 502Codebase Refactor
_fetch_csrf_token) to generic functionsStructured Logging
get_logger(__name__)to get a consistently configured logger.Config File
os.environreads and hardcoded settings with a single config.ini file read at import time via Python's built-in configparser.Tests
pytest, to test all flows for each function and api in app.py, utils.py, tasks.py, exceptions.py, and logger.py