Skip to content

fix: replace broad except Exception with specific exception types#105

Open
raiderrobert wants to merge 1 commit into
mainfrom
agent/fix/46-specific-exception-handlers
Open

fix: replace broad except Exception with specific exception types#105
raiderrobert wants to merge 1 commit into
mainfrom
agent/fix/46-specific-exception-handlers

Conversation

@raiderrobert

Copy link
Copy Markdown
Owner

Addresses #46.

See #46 for context.

What changed

  • src/napoln/core/resolver.py: Replaced except Exception with (OSError, yaml.YAMLError, UnicodeDecodeError) in _extract_version and _extract_description.
  • src/napoln/core/merger.py: Replaced except Exception with (OSError, UnicodeDecodeError) in has_conflict_markers.
  • src/napoln/core/manifest.py: Replaced except Exception with (OSError, tomllib.TOMLDecodeError) in read_manifest; replaced except Exception with except OSError in write_manifest temp cleanup.
  • src/napoln/core/store.py: Replaced except Exception with except OSError in store_skill temp cleanup.
  • src/napoln/commands/add.py: Replaced except Exception with (StoreError, OSError) for store, (PlacementError, OSError) for placement, and (ManifestError, OSError) for manifest reads in --skill picker.
  • src/napoln/commands/install.py: Replaced except Exception with (PlacementError, OSError) in _sync_manifest.
  • src/napoln/commands/enable.py: Replaced except Exception with (StoreError, OSError) and (PlacementError, OSError) in _place_skill_for_agent.
  • Added regression tests for all changes verifying expected failures are caught and programming bugs (e.g. TypeError) propagate uncaught.

How to verify

uv run pytest
uv run ruff check src/ tests/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant