Respond with error when searching
This commit is contained in:
parent
4c1234291a
commit
ec493be52d
|
@ -188,7 +188,10 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if channel == "" {
|
if channel == "" {
|
||||||
feeds, err := h.backend.Search(query)
|
feeds, err := h.backend.Search(query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), 500)
|
respondJSON(w, map[string]interface{}{
|
||||||
|
"query": query,
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
respondJSON(w, map[string][]microsub.Feed{
|
respondJSON(w, map[string][]microsub.Feed{
|
||||||
|
@ -197,7 +200,10 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
items, err := h.backend.ItemSearch(channel, query)
|
items, err := h.backend.ItemSearch(channel, query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), 500)
|
respondJSON(w, map[string]interface{}{
|
||||||
|
"query": query,
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
respondJSON(w, map[string]interface{}{
|
respondJSON(w, map[string]interface{}{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user