From 8db272d46cc009fbf801cdf5677383702d1cbce0 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Thu, 22 Jul 2021 01:34:33 -0500 Subject: [PATCH] check error --- osuapi/beatmapsets.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osuapi/beatmapsets.go b/osuapi/beatmapsets.go index fbbadfb..b4dce88 100644 --- a/osuapi/beatmapsets.go +++ b/osuapi/beatmapsets.go @@ -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 }