Use errors.AsType in MembershipProfile.Insert

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-14 12:04:13 +01:00
parent a74ebdd8b8
commit a3af41e6a1

View File

@@ -1263,8 +1263,7 @@ VALUES (
_, err := conn.Exec(ctx, q, args)
if err != nil {
var pgErr *pgconn.PgError
if errors.As(err, &pgErr) && pgErr.Code == "23505" {
if pgErr, ok := errors.AsType[*pgconn.PgError](err); ok && pgErr.Code == "23505" {
return ErrResourceAlreadyExists
}