diff options
author | 2023-08-17 17:26:21 +0100 | |
---|---|---|
committer | 2023-08-17 17:26:21 +0100 | |
commit | d5d6ad406f47ae738a7f6b1699b3b6e7ef916bb9 (patch) | |
tree | 44df2eaf48eca66023023569d4ba8d901d800226 /internal/db/bundb/errors.go | |
parent | [chore]: Bump github.com/jackc/pgx/v5 from 5.4.2 to 5.4.3 (#2112) (diff) | |
download | gotosocial-d5d6ad406f47ae738a7f6b1699b3b6e7ef916bb9.tar.xz |
[bugfix] fix double firing bun.DB query hooks (#2124)
* improve bun.DB wrapping readability + comments, fix double-firing query hooks
* fix incorrect code comment placement
* fix linter issues
* Update internal/db/basic.go
* do as the linter commmands ...
---------
Signed-off-by: kim <grufwub@gmail.com>
Co-authored-by: Daenney <daenney@users.noreply.github.com>
Diffstat (limited to 'internal/db/bundb/errors.go')
-rw-r--r-- | internal/db/bundb/errors.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/db/bundb/errors.go b/internal/db/bundb/errors.go index 6bec8edae..46735ca80 100644 --- a/internal/db/bundb/errors.go +++ b/internal/db/bundb/errors.go @@ -32,6 +32,11 @@ var errBusy = errors.New("busy") // processPostgresError processes an error, replacing any postgres specific errors with our own error type func processPostgresError(err error) error { + // Catch nil errs. + if err == nil { + return nil + } + // Attempt to cast as postgres pgErr, ok := err.(*pgconn.PgError) if !ok { @@ -50,6 +55,11 @@ func processPostgresError(err error) error { // processSQLiteError processes an error, replacing any sqlite specific errors with our own error type func processSQLiteError(err error) error { + // Catch nil errs. + if err == nil { + return nil + } + // Attempt to cast as sqlite sqliteErr, ok := err.(*sqlite.Error) if !ok { |