From 482f00fdfc52f0b4592014b37dc9e1749a7cfd6d Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sun, 23 Mar 2014 12:17:30 -0600 Subject: 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. --- error.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'error.go') 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} -- cgit v1.2.3