Skip to content
This repository was archived by the owner on May 30, 2022. It is now read-only.

Commit 94f6022

Browse files
committed
Update swd.go
1 parent febb312 commit 94f6022

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

swd.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net/http"
77
"net/url"
88
"os"
9+
"strconv"
910
"strings"
1011
"time"
1112

@@ -47,16 +48,16 @@ func DownloadFile(url string, filepath string) error {
4748
loadSp.Start()
4849

4950
out, err := os.Create(filepath) // Create the file
50-
defer out.Close()
5151
if err != nil {
5252
return err
5353
}
54+
defer out.Close()
5455

5556
resp, err := http.Get(url) // Get the data
56-
defer resp.Body.Close()
5757
if err != nil {
5858
return err
5959
}
60+
defer resp.Body.Close()
6061

6162
_, err = io.Copy(out, resp.Body) // Write the body to file
6263
if err != nil {
@@ -106,7 +107,7 @@ func main() {
106107
End()
107108

108109
if resp.StatusCode != 200 {
109-
logger("GAME NOT AVAILABLE OR SERVER IS DOWN", ERR)
110+
logger("GAME NOT AVAILABLE OR SERVER IS DOWN, CODE RESPONSE: "+strconv.Itoa(resp.StatusCode), ERR)
110111
} else {
111112
logger("GAME IS AVAILABLE FOR STEAM WORKSHOP DOWNLOADS", INFO)
112113
}

0 commit comments

Comments
 (0)