diff --git a/server/handlers.go b/server/handlers.go index 2e4b29f..b48787c 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -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 } diff --git a/template/static/javascripts/app.js b/template/static/javascripts/app.js index 8830a6a..8dc58f3 100644 --- a/template/static/javascripts/app.js +++ b/template/static/javascripts/app.js @@ -460,6 +460,8 @@ var vm = new Vue({ } else if (result.status === 'multiple') { vm.feedNewChoice = result.choice vm.feedNewChoiceSelected = result.choice[0].url + } else { + alert('No feeds found at the given url.') } vm.loading.newfeed = false })