Skip to content

Commit

Permalink
changing AssertionError to PoetryConsoleError
Browse files Browse the repository at this point in the history
  • Loading branch information
taconi committed Jan 11, 2025
1 parent 6aed61e commit 852f002
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/poetry_plugin_shell/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import cast

from poetry.console.commands.env_command import EnvCommand
from poetry.console.exceptions import PoetryConsoleError


if TYPE_CHECKING:
Expand Down Expand Up @@ -40,7 +41,9 @@ def handle(self) -> int:

# Be sure that we have the right type of environment.
env = self.env
assert env.is_venv()
if not env.is_venv():
error_msg = "Virtual environment cannot be activated"
raise PoetryConsoleError(error_msg)
env = cast("VirtualEnv", env)

# Setting this to avoid spawning unnecessary nested shells
Expand Down

0 comments on commit 852f002

Please sign in to comment.