Skip to content

Commit

Permalink
Stop returning unexpected errors to the user when parsing query args
Browse files Browse the repository at this point in the history
It's better to log this rather than expose this to the user since it can
lead to confusing error messages.

Signed-off-by: mprahl <[email protected]>
  • Loading branch information
mprahl authored and openshift-merge-bot[bot] committed Apr 5, 2024
1 parent e028c99 commit e0edfb4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions controllers/complianceeventsapi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,9 @@ func getComplianceEvents(db *sql.DB, w http.ResponseWriter,
return
}

writeErrMsgJSON(w, err.Error(), http.StatusInternalServerError)
log.Error(err, "parsing the query arguments unexpectedly failed")

writeErrMsgJSON(w, "Internal Error", http.StatusInternalServerError)

return
}
Expand Down Expand Up @@ -1214,7 +1216,9 @@ func getComplianceEventsCSV(db *sql.DB, w http.ResponseWriter, r *http.Request,
return
}

writeErrMsgJSON(w, queryArgsErr.Error(), http.StatusInternalServerError)
log.Error(queryArgsErr, "parsing the query arguments unexpectedly failed")

writeErrMsgJSON(w, "Internal Error", http.StatusInternalServerError)

return
}
Expand Down

0 comments on commit e0edfb4

Please sign in to comment.