Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add go mod #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"unicode"
"unicode/utf8"

"github.com/jackc/pgconn"
"github.com/lib/pq"
)

Expand Down Expand Up @@ -255,6 +256,27 @@ func GetError(err error) error {
Severity: pqerr.Severity,
}
}
case *pgconn.PgError:
er := pq.Error{
Severity: pqerr.Severity,
Code: pq.ErrorCode(pqerr.Code),
Message: pqerr.Message,
Detail: pqerr.Detail,
Hint: pqerr.Hint,
Position: string(pqerr.Position),
InternalPosition: string(pqerr.InternalPosition),
InternalQuery: pqerr.InternalQuery,
Where: pqerr.Where,
Schema: pqerr.SchemaName,
Table: pqerr.TableName,
Column: pqerr.ColumnName,
DataTypeName: pqerr.DataTypeName,
Constraint: pqerr.ConstraintName,
File: pqerr.File,
Line: string(pqerr.Line),
Routine: pqerr.Routine,
}
return GetError(er)
default:
return pqerr
}
Expand Down
29 changes: 29 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module github.com/Shyp/go-dberror

go 1.17

require (
github.com/jackc/pgconn v1.11.0
github.com/letsencrypt/boulder v0.0.0-20220218202553-ef9f0cdab50f
github.com/lib/pq v1.10.4
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/prometheus/client_golang v1.7.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.10.0 // indirect
github.com/prometheus/procfs v0.1.3 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
Loading