From b148283233eb47470ef1a4f57bddeed042429464 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 20 Jun 2026 11:10:00 -0400 Subject: [PATCH] refactor(ai_client): narrow 'except Exception' in _reread_file_items (Phase 9 site 8) Was: except Exception as e (broad) Now: except (OSError, UnicodeDecodeError) as e The err_item drain (returned via the refreshed list with error: True flag) is preserved. Only specific file I/O errors are caught now. --- src/ai_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ai_client.py b/src/ai_client.py index 1c9dbdaa..daae6cc9 100644 --- a/src/ai_client.py +++ b/src/ai_client.py @@ -991,7 +991,7 @@ def _reread_file_items(file_items: list[dict[str, Any]]) -> tuple[list[dict[str, new_item = {**item, "old_content": item.get("content", ""), "content": content, "error": False, "mtime": current_mtime} refreshed.append(new_item) changed.append(new_item) - except Exception as e: + except (OSError, UnicodeDecodeError) as e: err_item = {**item, "content": f"ERROR re-reading {p}: {e}", "error": True, "mtime": 0.0} refreshed.append(err_item) changed.append(err_item)