Skip to content

Add comprehensive error handling and HTTP request timeouts

Improve application reliability and debuggability by implementing proper error handling and adding timeout parameters to all external API requests to Wikidata.

Changes:

  • Replace 9 bare exception handlers with specific exception types (TypeError, KeyError, AttributeError, ValueError, and requests.exceptions.RequestException)
  • Add structured error logging with context in all app.py routes
  • Add 10-second timeout to all HTTP requests in pdclasses.py, search.py, and squeries.py
  • Catch requests.exceptions.RequestException for network-related errors

This prevents indefinite hangs when Wikidata APIs are slow or unresponsive, and provides detailed error information for debugging production issues.

Bug: T409914

Merge request reports

Loading