diff --git a/command/pr.go b/command/pr.go index 11485860b..584fd3a8f 100644 --- a/command/pr.go +++ b/command/pr.go @@ -269,12 +269,11 @@ func prView(cmd *cobra.Command, args []string) error { } else { pr, err := api.PullRequestForBranch(apiClient, baseRepo, branchWithOwner) if err != nil { - switch err.(type) { - case *api.NotFoundError: + var notFoundErr *api.NotFoundError + if errors.As(err, ¬FoundErr) { return fmt.Errorf("%s. To open a specific pull request use the pull request's number as an argument", err) - default: - return err } + return err } openURL = pr.URL