Skip to content

Commit 86265df

Browse files
committed
error code cleanup
1 parent e59dfe0 commit 86265df

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/cmd/cli/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ var rootCmd = &cobra.Command{
8585

8686
if err := cli.CheckLogin(cmd.Context(), client); err != nil && !nonInteractive {
8787
// Login now; only do this for authorization-related errors
88-
if e, ok := err.(*connect.Error); !ok || e.Code() != connect.CodeUnauthenticated {
88+
if connect.CodeOf(err) != connect.CodeUnauthenticated {
8989
return err
9090
}
9191
cli.Warn(" !", err)

src/pkg/cli/logout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func Logout(ctx context.Context, client defangv1connect.FabricControllerClient)
1212
Debug(" - Logging out")
1313
_, err := client.RevokeToken(ctx, connect.NewRequest(&emptypb.Empty{}))
1414
// Ignore unauthenticated errors, since we're logging out anyway
15-
if e, ok := err.(*connect.Error); !ok || e.Code() != connect.CodeUnauthenticated {
15+
if connect.CodeOf(err) != connect.CodeUnauthenticated {
1616
return err
1717
}
1818
// TODO: remove the cached token file

0 commit comments

Comments
 (0)