Skip to content

Commit

Permalink
Merge branch 'master' into 6298
Browse files Browse the repository at this point in the history
  • Loading branch information
innobead authored Jul 12, 2023
2 parents 429d735 + a523288 commit 844edfa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/rancher/go-rancher/client"
"github.com/sirupsen/logrus"

"github.com/longhorn/longhorn-manager/datastore"
"github.com/longhorn/longhorn-manager/metrics_collector/registry"
)

Expand All @@ -17,6 +18,12 @@ func HandleError(s *client.Schemas, t HandleFuncWithError) http.Handler {
return api.ApiHandler(s, http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
if err := t(rw, req); err != nil {
logrus.WithError(err).Warnf("HTTP handling error")

if datastore.ErrorIsNotFound(err) {
rw.WriteHeader(http.StatusNotFound)
return
}

apiContext := api.GetApiContext(req)
apiContext.WriteErr(err)
}
Expand Down

0 comments on commit 844edfa

Please sign in to comment.