File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 4
4
"net/http"
5
5
"net/url"
6
6
"time"
7
+
8
+ "github.com/kldzj/pzmod/util"
9
+ "github.com/spf13/cobra"
7
10
)
8
11
9
12
const (
@@ -19,7 +22,7 @@ func SetApiKey(key string) {
19
22
20
23
func getApiKey () string {
21
24
if steamApiKey == "" {
22
- panic ( "Steam API key not set" )
25
+ cobra . CheckErr ( util . ErrNoApiKey )
23
26
}
24
27
25
28
return steamApiKey
@@ -32,7 +35,7 @@ func newHttpClient() *http.Client {
32
35
func constructSteamApiUrl (path string ) (* url.URL , * url.Values ) {
33
36
url , err := url .Parse ("https://api.steampowered.com" + path )
34
37
if err != nil {
35
- panic (err )
38
+ cobra . CheckErr (err )
36
39
}
37
40
38
41
query := url .Query ()
Original file line number Diff line number Diff line change 9
9
ErrFileExists = errors .New ("file already exists" )
10
10
ErrInvalidKey = errors .New ("invalid key" )
11
11
ErrVerNotSet = errors .New ("version not set" )
12
+ ErrNoApiKey = errors .New ("no Steam API key set" )
12
13
)
You can’t perform that action at this time.
0 commit comments