Use new error.As method

This commit is contained in:
Corey Johnson 2019-12-12 11:09:50 -08:00
parent 92642f4d53
commit 9b5f7a8148

View file

@ -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, &notFoundErr) {
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