Private
Public Access
0
0

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.
This commit is contained in:
2026-06-20 11:10:00 -04:00
parent 745147ebf0
commit b148283233
+1 -1
View File
@@ -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)