Commit 9669acc1 authored by gwenn's avatar gwenn

Improve backup error handling.

parent 0b0ed9e5
...@@ -52,8 +52,10 @@ func (b *Backup) Step(npage int) error { ...@@ -52,8 +52,10 @@ func (b *Backup) Step(npage int) error {
rv := C.sqlite3_backup_step(b.sb, C.int(npage)) rv := C.sqlite3_backup_step(b.sb, C.int(npage))
if rv == C.SQLITE_OK || Errno(rv) == ErrBusy || Errno(rv) == ErrLocked { // TODO Trace busy/locked errors if rv == C.SQLITE_OK || Errno(rv) == ErrBusy || Errno(rv) == ErrLocked { // TODO Trace busy/locked errors
return nil return nil
} else if rv == C.SQLITE_DONE {
return Errno(rv)
} }
return Errno(rv) return b.dst.error(rv, "backup step failed")
} }
// BackupStatus reports backup progression // BackupStatus reports backup progression
...@@ -112,7 +114,7 @@ func (b *Backup) Close() error { ...@@ -112,7 +114,7 @@ func (b *Backup) Close() error {
} }
rv := C.sqlite3_backup_finish(b.sb) rv := C.sqlite3_backup_finish(b.sb)
if rv != C.SQLITE_OK { if rv != C.SQLITE_OK {
return Errno(rv) return b.dst.error(rv, "backup finish failed")
} }
b.sb = nil b.sb = nil
return nil return nil
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment