From c39399403e031a8c1ad53969770e4261d2c9e7aa Mon Sep 17 00:00:00 2001 From: lost+skunk Date: Wed, 4 Sep 2024 20:22:58 +0300 Subject: отображение ошибок MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/api.go') diff --git a/app/api.go b/app/api.go index 3d0871c..fdf8270 100644 --- a/app/api.go +++ b/app/api.go @@ -58,8 +58,12 @@ func (a API) Random() { a.Error("Sorry, butt NSFW on this are disabled, and the instance failed to find a random art without NSFW", 500) } - s, err := devianter.PerformSearch(string(rand.Intn(999)), rand.Intn(30), 'a') + s, err, daErr := devianter.PerformSearch(string(rand.Intn(999)), rand.Intn(30), 'a') try(err) + if daErr.RAW != nil { + continue + } + deviation := &s.Results[rand.Intn(len(s.Results))] if deviation.NSFW && !CFG.Nsfw { -- cgit v1.2.3