handle missing feeds
This commit is contained in:
parent
6df66afe44
commit
6bb7bf4157
2 changed files with 7 additions and 2 deletions
|
|
@ -176,10 +176,13 @@ func FeedListHandler(rw http.ResponseWriter, req *http.Request) {
|
|||
res, err := http.Get(feedUrl)
|
||||
if err != nil {
|
||||
handler(req).log.Print(err)
|
||||
rw.WriteHeader(http.StatusBadRequest)
|
||||
writeJSON(rw, map[string]string{"status": "notfound"})
|
||||
return
|
||||
} 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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue