aboutsummaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/feed.go12
-rw-r--r--internal/api/subscription.go9
2 files changed, 11 insertions, 10 deletions
diff --git a/internal/api/feed.go b/internal/api/feed.go
index 27f93ab7..33973402 100644
--- a/internal/api/feed.go
+++ b/internal/api/feed.go
@@ -41,9 +41,9 @@ func (h *handler) createFeed(w http.ResponseWriter, r *http.Request) {
return
}
- feed, err := feedHandler.CreateFeed(h.store, userID, &feedCreationRequest)
- if err != nil {
- json.ServerError(w, r, err)
+ feed, localizedError := feedHandler.CreateFeed(h.store, userID, &feedCreationRequest)
+ if localizedError != nil {
+ json.ServerError(w, r, localizedError.Error())
return
}
@@ -59,9 +59,9 @@ func (h *handler) refreshFeed(w http.ResponseWriter, r *http.Request) {
return
}
- err := feedHandler.RefreshFeed(h.store, userID, feedID, false)
- if err != nil {
- json.ServerError(w, r, err)
+ localizedError := feedHandler.RefreshFeed(h.store, userID, feedID, false)
+ if localizedError != nil {
+ json.ServerError(w, r, localizedError.Error())
return
}
diff --git a/internal/api/subscription.go b/internal/api/subscription.go
index eb744419..499d99a0 100644
--- a/internal/api/subscription.go
+++ b/internal/api/subscription.go
@@ -32,7 +32,7 @@ func (h *handler) discoverSubscriptions(w http.ResponseWriter, r *http.Request)
rssbridgeURL = intg.RSSBridgeURL
}
- subscriptions, finderErr := subscription.FindSubscriptions(
+ subscriptions, localizedError := subscription.FindSubscriptions(
subscriptionDiscoveryRequest.URL,
subscriptionDiscoveryRequest.UserAgent,
subscriptionDiscoveryRequest.Cookie,
@@ -42,12 +42,13 @@ func (h *handler) discoverSubscriptions(w http.ResponseWriter, r *http.Request)
subscriptionDiscoveryRequest.AllowSelfSignedCertificates,
rssbridgeURL,
)
- if finderErr != nil {
- json.ServerError(w, r, finderErr)
+
+ if localizedError != nil {
+ json.ServerError(w, r, localizedError.Error())
return
}
- if subscriptions == nil {
+ if len(subscriptions) == 0 {
json.NotFound(w, r)
return
}