Skip to content

fix: narrow bare except Exception in preset command reconciliation - #3842

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/presets-narrow-exception
Open

fix: narrow bare except Exception in preset command reconciliation#3842
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/presets-narrow-exception

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Summary

Narrow bare except Exception to specific exception types to let programming errors propagate.

Changes

  • presets/__init__.py: Replace except Exception with (ImportError, FileNotFoundError, OSError, ValueError, TypeError)

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Refines error handling during extension registration by replacing a broad except Exception with a more specific set of exception types, allowing unexpected errors to surface instead of being silently ignored.

Changes:

  • Replace a blanket exception handler with an explicit tuple of expected exception types for the extension registration fallback path.
Show a summary per file
File Description
src/specify_cli/presets/__init__.py Narrows the exception(s) that trigger fallback registration logic during extension registration.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment on lines +1730 to 1733
except (ImportError, FileNotFoundError, OSError, ValueError, TypeError):
# Extension registration failed; fall back to
# generic path-based registration below.
pass
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.

3 participants