Skip to content

Commit 0204329

Browse files
fix: narrow bare except Exception in preset command reconciliation (#3842)
* fix: narrow bare except Exception in preset command reconciliation Replace overly broad except Exception with specific exception types (ImportError, FileNotFoundError, OSError, ValueError, TypeError) to let programming errors propagate while still falling back to generic path-based registration for expected failures. * fix: narrow bare except Exception in preset command reconciliation Remove ValueError and TypeError from the except tuple per Copilot feedback. These can mask programming/contract errors that should fail fast. Keep only ImportError, FileNotFoundError, OSError which are expected from extension discovery/import/IO failures.
1 parent 57a8663 commit 0204329

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/specify_cli/presets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ def record_written(written: Dict[str, List[str]]) -> None:
20972097
)
20982098
record_written(written)
20992099
registered = True
2100-
except Exception:
2100+
except (ImportError, FileNotFoundError, OSError):
21012101
# Extension registration failed; fall back to
21022102
# generic path-based registration below.
21032103
pass

0 commit comments

Comments
 (0)