Use errors.AsType in MembershipProfile.Insert
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user