aboutsummaryrefslogtreecommitdiff
path: root/error.go
blob: b5302adf49f718a156fb204c1c41f077385b4eb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package bolt

var (
	InvalidError               = &Error{"Invalid database", nil}
	VersionMismatchError       = &Error{"version mismatch", nil}
	DatabaseNotOpenError       = &Error{"db is not open", nil}
	DatabaseAlreadyOpenedError = &Error{"db already open", nil}
	TransactionInProgressError = &Error{"writable transaction is already in progress", nil}
	InvalidTransactionError    = &Error{"txn is invalid", nil}
	BucketAlreadyExistsError   = &Error{"bucket already exists", nil}
)

type Error struct {
	message string
	cause   error
}

func (e *Error) Error() string {
	if e.cause != nil {
		return e.message + ": " + e.cause.Error()
	}
	return e.message
}