mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-04 23:45:07 +00:00
fix pgx connection error for old version
(cherry picked from commit d5c30b120e
)
This commit is contained in:
parent
13ddf707ab
commit
98349c8eaf
@ -2,8 +2,8 @@ package gerrors
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
"github.com/zitadel/logging"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@ -36,8 +36,7 @@ func ExtractZITADELError(err error) (c codes.Code, msg, id string, ok bool) {
|
||||
if err == nil {
|
||||
return codes.OK, "", "", false
|
||||
}
|
||||
connErr := new(pgconn.ConnectError)
|
||||
if ok := errors.As(err, &connErr); ok {
|
||||
if strings.Contains(err.Error(), "failed to connect to") { // version of pgx does not yet export the error type
|
||||
return codes.Internal, "db connection error", "", true
|
||||
}
|
||||
zitadelErr := new(zerrors.ZitadelError)
|
||||
|
Loading…
Reference in New Issue
Block a user