summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2016-03-21 09:00:23 -0600
committerBen Johnson <benbjohnson@yahoo.com>2016-03-21 09:00:23 -0600
commit7cb15349482742b0f44d5d6e63852f8a414ba1cc (patch)
tree89b96bd54ea84732fbfc3e8298986aeb0b0d3089
parentMerge pull request #528 from boltdb/windows (diff)
parentfix strict mode (diff)
downloaddedo-7cb15349482742b0f44d5d6e63852f8a414ba1cc.tar.gz
dedo-7cb15349482742b0f44d5d6e63852f8a414ba1cc.tar.xz
Merge pull request #538 from benbjohnson/strict-mode-fix
Fix strict mode
-rw-r--r--tx.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/tx.go b/tx.go
index 299c073..b8510fd 100644
--- a/tx.go
+++ b/tx.go
@@ -5,6 +5,7 @@ import (
"io"
"os"
"sort"
+ "strings"
"time"
"unsafe"
)
@@ -202,8 +203,17 @@ func (tx *Tx) Commit() error {
// If strict mode is enabled then perform a consistency check.
// Only the first consistency error is reported in the panic.
if tx.db.StrictMode {
- if err, ok := <-tx.Check(); ok {
- panic("check fail: " + err.Error())
+ ch := tx.Check()
+ var errs []string
+ for {
+ err, ok := <-ch
+ if !ok {
+ break
+ }
+ errs = append(errs, err.Error())
+ }
+ if len(errs) > 0 {
+ panic("check fail: " + strings.Join(errs, "\n"))
}
}