diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-23 12:17:30 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-23 12:20:16 -0600 |
commit | 482f00fdfc52f0b4592014b37dc9e1749a7cfd6d (patch) | |
tree | 7ecbac715fd4556b77cb46ff6a1096a39111fab5 /error.go | |
parent | Merge pull request #78 from benbjohnson/tx-managed (diff) | |
download | dedo-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.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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} |