summaryrefslogtreecommitdiff
path: root/internal/db
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db')
-rw-r--r--internal/db/bundb/errors.go4
-rw-r--r--internal/db/bundb/trace.go9
2 files changed, 2 insertions, 11 deletions
diff --git a/internal/db/bundb/errors.go b/internal/db/bundb/errors.go
index d01720731..113679226 100644
--- a/internal/db/bundb/errors.go
+++ b/internal/db/bundb/errors.go
@@ -35,8 +35,8 @@ func processSQLiteError(err error) db.Error {
// Handle supplied error code:
switch sqliteErr.Code() {
- case sqlite3.SQLITE_CONSTRAINT_UNIQUE:
- return db.NewErrAlreadyExists(err.Error())
+ 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())
}