Skip to content

Commit

Permalink
chore(cli): only report errors when opening VSCode if at least one me…
Browse files Browse the repository at this point in the history
…thod from CLI and custom scheme actually fails
  • Loading branch information
pascalbreuninger committed Jan 10, 2025
1 parent db6321b commit 7a52e3e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/ide/vscode/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package vscode

import (
"context"
"errors"
"fmt"
"os/exec"
"runtime"
Expand All @@ -14,14 +15,13 @@ import (

func Open(ctx context.Context, workspace, folder string, newWindow bool, flavor Flavor, log log.Logger) error {
log.Infof("Starting %s...", flavor)
err := openViaCLI(ctx, workspace, folder, newWindow, flavor, log)
if err != nil {
log.Debugf("Error opening %s via cli: %v", flavor, err)
} else {
cliErr := openViaCLI(ctx, workspace, folder, newWindow, flavor, log)
if cliErr == nil {
return nil
}

return openViaBrowser(workspace, folder, newWindow, flavor, log)
browserErr := openViaBrowser(workspace, folder, newWindow, flavor, log)
return errors.Join(cliErr, browserErr)
}

func openViaBrowser(workspace, folder string, newWindow bool, flavor Flavor, log log.Logger) error {
Expand Down

0 comments on commit 7a52e3e

Please sign in to comment.