Skip to content

auth.Login panics on a database error instead of returning it #160

Description

@can3p

auth.Login (pkg/auth/auth.go) returns "Bad credentials" for sql.ErrNoRows, but calls panic(err) for any other database error. CheckCredentials returns the same error normally. The panic reaches gin's recovery middleware and turns a transient database problem into a 500 with a stack trace in the logs.

Repro: call auth.Login with an executor whose query fails, for example a closed connection. It panics.

Expected: Login returns the error.

Pinned by a skipped test in pkg/auth/auth_db_test.go (W2).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions