From f63ffedac74f86413b1da1789b9346ced4429721 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 13 May 2023 09:54:56 -0500 Subject: [PATCH] Updated Error Handling (markdown) --- Error-Handling.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Error-Handling.md b/Error-Handling.md index 47389b9..f6c9b87 100644 --- a/Error-Handling.md +++ b/Error-Handling.md @@ -5,6 +5,11 @@ pgx uses Go 1.13+ style error wrapping. That means that `errors.Is()` and `error If an error is returned from PostgreSQL then underlying error type will be a [*pgconn.PgError](https://pkg.go.dev/github.com/jackc/pgconn?tab=doc#PgError). ```go +// Be sure the correct package is imported, this will not work if the old, standalone pgconn repo is imported instead. +import "github.com/jackc/pgx/v5/pgconn" + +// ... + err = conn.QueryRow(context.Background(), "select 1 +").Scan(&greeting) if err != nil { var pgErr *pgconn.PgError