Skip to content

chore: Rbac errors should be returned, and not hidden behind 404 #7122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: Rbac errors should be returned, and not hidden behind 404
SqlErrNoRows was hiding actual errors
  • Loading branch information
Emyrk committed Apr 13, 2023
commit b33e7f61e63e49e5b83c7754b15ae32441229e77
4 changes: 2 additions & 2 deletions coderd/database/dbauthz/dbauthz.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func (e NotAuthorizedError) Error() string {

// Unwrap will always unwrap to a sql.ErrNoRows so the API returns a 404.
// So 'errors.Is(err, sql.ErrNoRows)' will always be true.
func (NotAuthorizedError) Unwrap() error {
return sql.ErrNoRows
func (e NotAuthorizedError) Unwrap() error {
return e.Err
}

func IsNotAuthorizedError(err error) bool {
Expand Down