check error
This commit is contained in:
parent
004acffce1
commit
8db272d46c
1 changed files with 5 additions and 0 deletions
|
@ -27,9 +27,14 @@ func (api *Osuapi) SearchBeatmaps(rankStatus string) (beatmapSearch BeatmapSearc
|
|||
func (api *Osuapi) DownloadSingleBeatmap(beatmapId int, path string) (err error) {
|
||||
url := fmt.Sprintf("https://osu.ppy.sh/osu/%d", beatmapId)
|
||||
resp, err := api.httpClient.Get(url)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "could not fetch beatmap")
|
||||
return
|
||||
}
|
||||
|
||||
file, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR, 0644)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "could not open file for downloading beatmap")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue