Skip to content

Commit

Permalink
fix: raising exception instead of printing the error
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Oct 16, 2024
1 parent 5fddb38 commit 3f5e3af
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions dreadnode_cli/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pydantic
import typer
from rich import print

from dreadnode_cli.defaults import USER_CONFIG_PATH
Expand Down Expand Up @@ -47,11 +46,8 @@ def set_profile_config(self, profile: str, config: ServerConfig) -> "UserConfig"
def set_active_config(self, config: ServerConfig) -> "UserConfig":
self._update_active()
if not self.active or not self.servers:
print()
print(":exclamation: No servers are configured")
print()
print("Use [bold]dreadnode login[/] to authenticate")
raise typer.Exit(1)
raise Exception("No servers are configured, use [bold]dreadnode login[/] to authenticate")

self.servers[self.active] = config
return self

Expand All @@ -64,10 +60,6 @@ def remove_profile_config(self, profile: str) -> "UserConfig":
def active_server(self) -> ServerConfig:
self._update_active()
if not self.active or not self.servers:
print()
print(":exclamation: No servers are configured")
print()
print("Use [bold]dreadnode login[/] to authenticate")
raise typer.Exit(1)
raise Exception("No servers are configured, use [bold]dreadnode login[/] to authenticate")

return self.servers[self.active]

0 comments on commit 3f5e3af

Please sign in to comment.