Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix ImmediateExit usage in list command
- Provide both message and code arguments as required by constructor
- Add proper exception chaining with 'from exc'
- Document raised exception in docstring

Fixes linting errors: B904, DOC501, DOC503, E1120, call-arg, arg-type
  • Loading branch information
cidrblock committed Aug 6, 2025
commit 795b7fa412024cbd2206de70aab071078926f0a8
5 changes: 4 additions & 1 deletion src/molecule/command/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def list_(ctx: click.Context) -> None: # pragma: no cover

Args:
ctx: Click context object holding commandline arguments.

Raises:
ImmediateExit: If scenario configuration fails.
"""
args = ctx.obj.get("args")
subcommand = base._get_subcommand(__name__) # noqa: SLF001
Expand All @@ -81,7 +84,7 @@ def list_(ctx: click.Context) -> None: # pragma: no cover
try:
configs = base.get_configs(args, command_args)
except ScenarioFailureError as exc:
raise ImmediateExit(exc.code)
raise ImmediateExit(str(exc), exc.code) from exc

s = scenarios.Scenarios(
configs,
Expand Down