Skip to content

Commit c081533

Browse files
committed
add defined error
1 parent a00ac0b commit c081533

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

digestabotctl/cmd/files.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ func handlePRForPlatform(platform string, checkout versioncontrol.CheckoutRespon
115115
}
116116

117117
return nil
118-
119118
}
120119
case "gitlab":
121120
{
@@ -132,7 +131,7 @@ func handlePRForPlatform(platform string, checkout versioncontrol.CheckoutRespon
132131
}
133132
default:
134133
{
135-
return fmt.Errorf("invalid platform")
134+
return platforms.ErrInvalidPlatform
136135
}
137136
}
138137
}

digestabotctl/platforms/platforms.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package platforms
22

33
import (
4+
"errors"
45
"fmt"
56
"io"
67
"net/http"
@@ -11,8 +12,9 @@ import (
1112
var successCodes = []int{200, 201, 202, 203, 204}
1213

1314
var (
14-
ValidPlatforms = []string{"github", "gitlab"}
15-
ErrBadResponse = fmt.Errorf("request was unsuccessful")
15+
ValidPlatforms = []string{"github", "gitlab"}
16+
ErrBadResponse = errors.New("request was unsuccessful")
17+
ErrInvalidPlatform = errors.New("invalid platform")
1618
)
1719

1820
var prTemplate = `{{ $tick := "` + "```" + `" -}}

0 commit comments

Comments
 (0)