From 9b5f7a8148c5af5458288ff6cc99ee14af9833d0 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Thu, 12 Dec 2019 11:09:50 -0800 Subject: [PATCH] Use new error.As method --- command/pr.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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