refactor: moved hashing logic into application layer for security;
fix: error handling in auth service for database; refactor: removed redundant taken email check; chore: removed todos that were completed/not needed; fix: leaking transactions in complete registration and login on error; refactor: got rid of txless requests during transactions;
This commit is contained in:
17
backend/internal/errors/postgres.go
Normal file
17
backend/internal/errors/postgres.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package errors
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
)
|
||||
|
||||
func GetPgError(err error) string {
|
||||
var pgErr *pgconn.PgError
|
||||
errors.As(err, &pgErr)
|
||||
return pgErr.Code
|
||||
}
|
||||
|
||||
func MatchPgError(err error, code string) bool {
|
||||
return GetPgError(err) == code
|
||||
}
|
||||
Reference in New Issue
Block a user