Skip to content

Commit

Permalink
Refactor HTTP Client and LocalizedError packages
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillot committed Oct 22, 2023
1 parent 5e6c054 commit 687a759
Show file tree
Hide file tree
Showing 101 changed files with 1,203 additions and 10,633 deletions.
2 changes: 0 additions & 2 deletions .github/codeql/config.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ jobs:

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/config.yml

- name: Autobuild
uses: github/codeql-action/autobuild@v2
Expand Down
12 changes: 6 additions & 6 deletions internal/api/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down
9 changes: 5 additions & 4 deletions internal/api/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (h *handler) discoverSubscriptions(w http.ResponseWriter, r *http.Request)
return
}

subscriptions, finderErr := subscription.FindSubscriptions(
subscriptions, localizedError := subscription.FindSubscriptions(
subscriptionDiscoveryRequest.URL,
subscriptionDiscoveryRequest.UserAgent,
subscriptionDiscoveryRequest.Cookie,
Expand All @@ -34,12 +34,13 @@ func (h *handler) discoverSubscriptions(w http.ResponseWriter, r *http.Request)
subscriptionDiscoveryRequest.FetchViaProxy,
subscriptionDiscoveryRequest.AllowSelfSignedCertificates,
)
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
}
Expand Down
31 changes: 0 additions & 31 deletions internal/errors/errors.go

This file was deleted.

10 changes: 5 additions & 5 deletions internal/googlereader/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,9 @@ func (h *handler) quickAddHandler(w http.ResponseWriter, r *http.Request) {
return
}

subscriptions, s_err := mfs.FindSubscriptions(url, "", "", "", "", false, false)
if s_err != nil {
json.ServerError(w, r, s_err)
subscriptions, localizedError := mfs.FindSubscriptions(url, "", "", "", "", false, false)
if localizedError != nil {
json.ServerError(w, r, localizedError.Error())
return
}

Expand Down Expand Up @@ -746,9 +746,9 @@ func subscribe(newFeed Stream, category Stream, title string, store *storage.Sto
return nil, verr.Error()
}

created, err := mff.CreateFeed(store, userID, &feedRequest)
created, localizedError := mff.CreateFeed(store, userID, &feedRequest)
if err != nil {
return nil, err
return nil, localizedError.Error()
}

if title != "" {
Expand Down
Loading

0 comments on commit 687a759

Please sign in to comment.