mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
handle missing feeds
This commit is contained in:
parent
6df66afe44
commit
6bb7bf4157
@ -176,10 +176,13 @@ func FeedListHandler(rw http.ResponseWriter, req *http.Request) {
|
|||||||
res, err := http.Get(feedUrl)
|
res, err := http.Get(feedUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
handler(req).log.Print(err)
|
handler(req).log.Print(err)
|
||||||
rw.WriteHeader(http.StatusBadRequest)
|
writeJSON(rw, map[string]string{"status": "notfound"})
|
||||||
return
|
return
|
||||||
} else if res.StatusCode != 200 {
|
} else if res.StatusCode != 200 {
|
||||||
rw.WriteHeader(http.StatusBadRequest)
|
handler(req).log.Printf("Failed to fetch %s (status: %d)", feedUrl, res.StatusCode)
|
||||||
|
body, err := ioutil.ReadAll(res.Body)
|
||||||
|
handler(req).log.Print(string(body), err)
|
||||||
|
writeJSON(rw, map[string]string{"status": "notfound"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,6 +460,8 @@ var vm = new Vue({
|
|||||||
} else if (result.status === 'multiple') {
|
} else if (result.status === 'multiple') {
|
||||||
vm.feedNewChoice = result.choice
|
vm.feedNewChoice = result.choice
|
||||||
vm.feedNewChoiceSelected = result.choice[0].url
|
vm.feedNewChoiceSelected = result.choice[0].url
|
||||||
|
} else {
|
||||||
|
alert('No feeds found at the given url.')
|
||||||
}
|
}
|
||||||
vm.loading.newfeed = false
|
vm.loading.newfeed = false
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user