aboutsummaryrefslogtreecommitdiff
path: root/error.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-03-23 12:17:30 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-03-23 12:20:16 -0600
commit482f00fdfc52f0b4592014b37dc9e1749a7cfd6d (patch)
tree7ecbac715fd4556b77cb46ff6a1096a39111fab5 /error.go
parentMerge pull request #78 from benbjohnson/tx-managed (diff)
downloaddedo-482f00fdfc52f0b4592014b37dc9e1749a7cfd6d.tar.gz
dedo-482f00fdfc52f0b4592014b37dc9e1749a7cfd6d.tar.xz
Add ErrTxClosed error.
Commit/Rollback and mutable calls on Tx and Bucket now return ErrTxClosed if the transaction has already been committed or rolled back. Non-mutable calls have added an assertion to check if the transaction is closed which will cause a panic. I don't want to introduce an error return for accessor methods that are being used improperly so I think the panic is appropriate.
Diffstat (limited to 'error.go')
-rw-r--r--error.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/error.go b/error.go
index 7f867b2..f88f47e 100644
--- a/error.go
+++ b/error.go
@@ -20,6 +20,10 @@ var (
// read-only transaction.
ErrTxNotWritable = &Error{"tx not writable", nil}
+ // ErrTxClosed is returned when committing or rolling back a transaction
+ // that has already been committed or rolled back.
+ ErrTxClosed = &Error{"tx closed", nil}
+
// ErrBucketNotFound is returned when trying to access a bucket that has
// not been created yet.
ErrBucketNotFound = &Error{"bucket not found", nil}