Skip to content

fix: replace bare except clauses with except Exception (3 files)#3371

Open
harshadkhetpal wants to merge 3 commits intobunkerity:masterfrom
harshadkhetpal:fix/bare-except-to-exception
Open

fix: replace bare except clauses with except Exception (3 files)#3371
harshadkhetpal wants to merge 3 commits intobunkerity:masterfrom
harshadkhetpal:fix/bare-except-to-exception

Conversation

@harshadkhetpal
Copy link
Copy Markdown

Summary

Replace bare except: clauses with except Exception: across 3 files (4 occurrences).

Per PEP 8, bare except: clauses should specify an exception type. Since none of these handlers re-raise the caught exception, except Exception: is the appropriate replacement — it catches all standard exceptions while still allowing KeyboardInterrupt and SystemExit to propagate normally.

Files changed:

  • src/autoconf/main.py (1 occurrence)
  • src/common/utils/jobs.py (2 occurrences)
  • src/common/gen/save_config.py (1 occurrence)

Change pattern:

# Before
except:
    return False, f"exception :\n{format_exc()}"

# After
except Exception:
    return False, f"exception :\n{format_exc()}"

Testing

No behavior change for standard exceptions — KeyboardInterrupt and SystemExit will now propagate correctly instead of being silently caught.

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