a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
29 lines
914 B
Go
29 lines
914 B
Go
package ledger
|
|
|
|
import "errors"
|
|
|
|
var (
|
|
// ErrUnbalanced is returned when a transaction's entries do not sum to zero.
|
|
ErrUnbalanced = errors.New("ledger: transaction is unbalanced")
|
|
// ErrUnknownAccount is returned when an entry names an account that does not exist.
|
|
ErrUnknownAccount = errors.New("ledger: unknown account")
|
|
// ErrCurrencyMismatch is returned when amounts of different currencies are combined.
|
|
ErrCurrencyMismatch = errors.New("ledger: currency mismatch")
|
|
// ErrEmptyTransaction is returned when a transaction has no entries.
|
|
ErrEmptyTransaction = errors.New("ledger: transaction has no entries")
|
|
)
|
|
|
|
// PostingError wraps a lower-level error with the transaction it came from.
|
|
type PostingError struct {
|
|
TxID string
|
|
Err error
|
|
}
|
|
|
|
func (e *PostingError) Error() string {
|
|
return "ledger: posting " + e.TxID + ": " + e.Err.Error()
|
|
}
|
|
|
|
func (e *PostingError) Unwrap() error {
|
|
return e.Err
|
|
}
|