Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

Commit 883f9ab

Browse files
committed
added more context to error to diagnose GH actions faillure
1 parent c4c1e64 commit 883f9ab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

database/postgresql/base.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import (
55
"encoding/json"
66
"errors"
77
"fmt"
8-
"github.com/lib/pq"
98
"strings"
109
"time"
1110

11+
"github.com/lib/pq"
12+
1213
"github.com/staticbackendhq/core/internal"
1314
)
1415

@@ -62,6 +63,7 @@ func (pg *PostgreSQL) CreateDocument(auth internal.Auth, dbName, col string, doc
6263
`, dbName, cleancol, dbName, dbName, cleancol, dbName, cleancol)
6364

6465
if _, err = pg.DB.Exec(qry); err != nil {
66+
err = fmt.Errorf("error creating table: %w", err)
6567
return
6668
}
6769

@@ -75,10 +77,14 @@ func (pg *PostgreSQL) CreateDocument(auth internal.Auth, dbName, col string, doc
7577

7678
b, err := json.Marshal(doc)
7779
if err != nil {
80+
err = fmt.Errorf("error executing INSERT: %w", err)
7881
return
7982
}
8083

8184
err = pg.DB.QueryRow(qry, auth.AccountID, auth.UserID, b, time.Now()).Scan(&id)
85+
if err != nil {
86+
err = fmt.Errorf("error getting the new row ID: %w", err)
87+
}
8288

8389
inserted[FieldID] = id
8490
inserted[FieldAccountID] = auth.AccountID

0 commit comments

Comments
 (0)