Skip to content

Commit 5c840fd

Browse files
committed
Return empty list for sql.ErrNoRows in coderd users endpoint
1 parent 878d633 commit 5c840fd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

coderd/users.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ func (api *api) users(rw http.ResponseWriter, r *http.Request) {
122122
Search: searchName,
123123
Status: statusFilter,
124124
})
125+
if errors.Is(err, sql.ErrNoRows) {
126+
httpapi.Write(rw, http.StatusOK, []codersdk.User{})
127+
return
128+
}
125129
if err != nil {
126130
httpapi.Write(rw, http.StatusInternalServerError, httpapi.Response{
127131
Message: err.Error(),

0 commit comments

Comments
 (0)