Skip to content

Commit 62f83a0

Browse files
committed
Simplify "SchemaError" message
Remove a redundant "create schema: " chain.
1 parent b8f4adc commit 62f83a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/sqlrunner.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"database/sql"
99
"database/sql/driver"
1010
"encoding/hex"
11+
"errors"
1112
"fmt"
1213
"log/slog"
1314
"os"
@@ -210,6 +211,9 @@ func (r *SQLRunner) Query(ctx context.Context, query string) (*QueryResult, erro
210211
// You should close the database after using it.
211212
func (r *SQLRunner) getSqliteInstance() (*sql.DB, error) {
212213
filename, err := initializeThreadSafe(r.schema)
214+
if errors.As(err, &SchemaError{}) {
215+
return nil, err
216+
}
213217
if err != nil {
214218
return nil, NewSchemaError(err)
215219
}
@@ -256,7 +260,7 @@ func initialize(schema string) (filename string, err error) {
256260
}
257261

258262
if _, err := drv.Exec(schema); err != nil {
259-
return "", fmt.Errorf("create schema: %w", err)
263+
return "", NewSchemaError(err)
260264
}
261265

262266
if err := drv.Close(); err != nil {

0 commit comments

Comments
 (0)