Skip to content

Commit cb65f20

Browse files
Copilotmnriem
andauthored
fix(extensions): use conventional errno (EISDIR/ENOENT) for non-regular-file registry
Assisted-by: GitHub Copilot (model: Claude Opus 4.8, autonomous) Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
1 parent 6022181 commit cb65f20

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎src/specify_cli/extensions/__init__.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,12 +662,13 @@ def _load(self) -> dict:
662662
# non-file cannot be parsed, and silently starting fresh here would
663663
# reopen the fail-open directory scan. Fail closed instead so callers
664664
# (e.g. runtime resolution) surface the tampered/broken registry
665-
# rather than treating every on-disk extension as enabled. (A
666-
# directory already raised IsADirectoryError from the read below; this
667-
# makes broken symlinks consistent with that behavior.)
665+
# rather than treating every on-disk extension as enabled. This raises
666+
# the same error open() would: EISDIR for a directory (as before) and
667+
# ENOENT for a dangling symlink whose target is missing.
668668
if not self.registry_path.is_file():
669+
code = errno.EISDIR if self.registry_path.is_dir() else errno.ENOENT
669670
raise OSError(
670-
errno.EINVAL,
671+
code,
671672
"Extension registry is not a readable regular file",
672673
str(self.registry_path),
673674
)

0 commit comments

Comments
 (0)