Skip to content

Commit

Permalink
chore: add error handling to FeatureFlagMiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
juggernot325 committed Nov 16, 2023
1 parent cf2c335 commit 64bbb76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/api/src/api/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func FeatureFlagMiddleware(db database.Database, flagKey string) mux.MiddlewareF
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
if flag, err := db.GetFlagByKey(flagKey); err != nil {

api.WriteErrorResponse(request.Context(), api.BuildErrorResponse(http.StatusInternalServerError, fmt.Sprintf("error retrieving %s feature flag: %s", flagKey, err), request), response)
} else if flag.Enabled {
next.ServeHTTP(response, request)
} else {
Expand Down

0 comments on commit 64bbb76

Please sign in to comment.