diff options
author | 2022-02-12 18:27:58 +0000 | |
---|---|---|
committer | 2022-02-12 18:27:58 +0000 | |
commit | 31935ee206107f077878d3cdb6a26b82436b6893 (patch) | |
tree | 2d522bf98013dc5a4539133561b645fd7457eb06 /internal/db | |
parent | [chore] Add nightly mirror to Codeberg.org (#392) (diff) | |
parent | Go mod tidy (diff) | |
download | gotosocial-31935ee206107f077878d3cdb6a26b82436b6893.tar.xz |
Merge pull request #361 from superseriousbusiness/media_refactorv0.2.0
Refactor media handler to allow async media resolution
Diffstat (limited to 'internal/db')
-rw-r--r-- | internal/db/bundb/errors.go | 2 | ||||
-rw-r--r-- | internal/db/bundb/trace.go | 9 |
2 files changed, 1 insertions, 10 deletions
diff --git a/internal/db/bundb/errors.go b/internal/db/bundb/errors.go index d01720731..67a673e15 100644 --- a/internal/db/bundb/errors.go +++ b/internal/db/bundb/errors.go @@ -35,7 +35,7 @@ func processSQLiteError(err error) db.Error { // Handle supplied error code: switch sqliteErr.Code() { - case sqlite3.SQLITE_CONSTRAINT_UNIQUE: + case sqlite3.SQLITE_CONSTRAINT_UNIQUE, sqlite3.SQLITE_CONSTRAINT_PRIMARYKEY: return db.NewErrAlreadyExists(err.Error()) default: return err diff --git a/internal/db/bundb/trace.go b/internal/db/bundb/trace.go index 3726506a9..9eaad6880 100644 --- a/internal/db/bundb/trace.go +++ b/internal/db/bundb/trace.go @@ -20,7 +20,6 @@ package bundb import ( "context" - "database/sql" "time" "github.com/sirupsen/logrus" @@ -48,13 +47,5 @@ func (q *debugQueryHook) AfterQuery(_ context.Context, event *bun.QueryEvent) { "operation": event.Operation(), }) - if event.Err != nil && event.Err != sql.ErrNoRows { - // if there's an error the it'll be handled in the application logic, - // but we can still debug log it here alongside the query - l = l.WithField("query", event.Query) - l.Debug(event.Err) - return - } - l.Tracef("[%s] %s", dur, event.Operation()) } |