diff --git a/backup.go b/backup.go index 5ab3a54..7f1eec9 100644 --- a/backup.go +++ b/backup.go @@ -48,7 +48,7 @@ func (b *SQLiteBackup) Step(p int) (bool, error) { if ret == C.SQLITE_DONE { return true, nil } else if ret != 0 && ret != C.SQLITE_LOCKED && ret != C.SQLITE_BUSY { - return false, Error{Code: ErrNo(ret)} + return false, &Error{Code: ErrNo(ret)} } return false, nil } @@ -79,7 +79,7 @@ func (b *SQLiteBackup) Close() error { runtime.SetFinalizer(b, nil) if ret != 0 { - return Error{Code: ErrNo(ret)} + return &Error{Code: ErrNo(ret)} } return nil } diff --git a/error.go b/error.go index 7d29b4b..be530e5 100644 --- a/error.go +++ b/error.go @@ -58,7 +58,7 @@ var ( // Error return error message from errno. func (err ErrNo) Error() string { - return Error{Code: err}.Error() + return (&Error{Code: err}).Error() } // Extend return extended errno. @@ -68,7 +68,7 @@ func (err ErrNo) Extend(by int) ErrNoExtended { // Error return error message that is extended code. func (err ErrNoExtended) Error() string { - return Error{Code: ErrNo(C.int(err) & ErrNoMask), ExtendedCode: err}.Error() + return (&Error{Code: ErrNo(C.int(err) & ErrNoMask), ExtendedCode: err}).Error() } // Error return error message. diff --git a/sqlite3.go b/sqlite3.go index 6230b29..0ae415f 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -404,7 +404,7 @@ func (c *SQLiteConn) lastError() *Error { if rv == C.SQLITE_OK { return nil } - return Error{ + return &Error{ Code: ErrNo(rv), ExtendedCode: ErrNoExtended(C.sqlite3_extended_errcode(c.db)), err: C.GoString(C.sqlite3_errmsg(c.db)), @@ -601,7 +601,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { C.SQLITE_OPEN_CREATE, nil) if rv != 0 { - return nil, Error{Code: ErrNo(rv)} + return nil, &Error{Code: ErrNo(rv)} } if db == nil { return nil, errors.New("sqlite succeeded without returning a database") @@ -609,7 +609,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { rv = C.sqlite3_busy_timeout(db, C.int(busyTimeout)) if rv != C.SQLITE_OK { - return nil, Error{Code: ErrNo(rv)} + return nil, &Error{Code: ErrNo(rv)} } conn := &SQLiteConn{db: db, loc: loc, txlock: txlock}