From 247896b8b7c0279a446f2835e27d4683c5c021b0 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Thu, 15 Apr 2021 11:51:22 -0600 Subject: [PATCH] Remove reference to "wal" in first db init command This commit changes the error message of the first SQL command executed during initialization. Typically, it wraps the error with a message of "enable wal" since it is enabling the WAL mode but that can be confusing if the DB connection or file is invalid. Instead, the error is returned as-is and we can determine the source of the error since it is the only unwrapped DB-related error. --- db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.go b/db.go index 22830df..28d3f90 100644 --- a/db.go +++ b/db.go @@ -452,7 +452,7 @@ func (db *DB) init() (err error) { // https://www.sqlite.org/pragma.html#pragma_journal_mode var mode string if err := db.db.QueryRow(`PRAGMA journal_mode = wal;`).Scan(&mode); err != nil { - return fmt.Errorf("enable wal: %w", err) + return err } else if mode != "wal" { return fmt.Errorf("enable wal failed, mode=%q", mode) }