Create error_handler.py in /app with an APIErrorHandler class that wraps HTTP requests. We're getting inconsistent error handling and need a consistent way to handle API failures. The APIErrorHandler class should have an intercept_request method that takes an HTTP method, URL, and optional parameters like timeout and headers. Use requests.request() to make the actual HTTP calls. The class needs to be importable so tests can use it. ## Response Format When requests succeed (status 2xx), return: ```python {'success': True, 'data': response_data} ``` When they fail (status 4xx or 5xx), return: ```python {'error': error_message} ``` For 401 responses specifically, include an 'action': 'logout' key: ```python {'error': 'Unauthorized', 'action': 'logout'} ``` For 500 errors, return this exact generic message (do not leak server details): ```python {'error': 'Server Error', 'message': 'Something went wrong. Please try again.'} ``` ## Network Error Handling Handle network errors and timeouts gracefully. When a requests.exceptions.Timeout exception occurs, catch it and return an error response. Other network errors (ConnectionError, RequestException) should also be caught and handled. For network errors that don't have HTTP status codes (Timeout, ConnectionError, etc.), use `status_code: 0` in the log entry. ## Error Logging Persist all errors to a JSON file at /app/error_log.json. Each error log entry must be a dictionary with exactly these keys: - `timestamp`: ISO 8601 format with 'Z' suffix (use `datetime.utcnow().isoformat() + 'Z'`) - `status_code`: HTTP status code (integer), or 0 for network errors without status codes - `endpoint`: The URL that was requested (string) - `error_message`: A brief description of the error (string) Example log entry: ```python { 'timestamp': '2024-01-15T10:30:00.123456Z', 'status_code': 404, 'endpoint': 'http://example.com/api/users', 'error_message': 'Not found' } ``` Example log entry for network error: ```python { 'timestamp': '2024-01-15T10:30:00.123456Z', 'status_code': 0, 'endpoint': 'http://example.com/api/timeout', 'error_message': 'Timeout' } ``` The log file should be loaded on initialization and updated after each error. Provide get_errors() and clear_errors() methods so tests can check and reset the log.