Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/codegen/cli/auth/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def wrapper(*args, **kwargs):
# Check for valid session
if session is None:
pretty_print_error("There is currently no active session.\nPlease run 'codegen init' to initialize the project.")
raise typer.Abort()
raise typer.Exit(1)

if (token := get_current_token()) is None:
rich.print("[yellow]Not authenticated. Let's get you logged in first![/yellow]\n")
Expand Down
6 changes: 3 additions & 3 deletions src/codegen/cli/auth/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class CodegenSession:
def __init__(self, repo_path: Path, git_token: str | None = None) -> None:
if not repo_path.exists():
rich.print(f"\n[bold red]Error:[/bold red] Path to git repo does not exist at {repo_path}")
raise typer.Abort()
raise typer.Exit(1)

# Check if it's a valid git repository
try:
LocalGitRepo(repo_path=repo_path)
except Exception:
rich.print(f"\n[bold red]Error:[/bold red] Path {repo_path} is not a valid git repository")
raise typer.Abort()
raise typer.Exit(1)

self.repo_path = repo_path
self.local_git = LocalGitRepo(repo_path=repo_path)
Expand Down Expand Up @@ -87,7 +87,7 @@ def _validate(self) -> None:
except BadCredentialsException:
rich.print(format_command(f"\n[bold red]Error:[/bold red] Invalid GitHub token={git_token} for repo={self.local_git.full_name}"))
rich.print("[white]Please provide a valid GitHub token for this repository.[/white]")
raise typer.Abort()
raise typer.Exit(1)

def __str__(self) -> str:
return f"CodegenSession(user={self.config.repository.user_name}, repo={self.config.repository.name})"
2 changes: 1 addition & 1 deletion src/codegen/cli/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ def wrapper(*args, **kwargs):
return f(*args, **kwargs)
except AuthError:
rich.print(Panel("[red]Authentication Error:[/red] Please run 'codegen login' first.", title="Codegen Error", border_style="red"))
raise typer.Abort()
raise typer.Exit(1)

return wrapper