mirror of
https://github.com/hanzoai/money.git
synced 2026-09-30 22:56:51 +00:00
HIP-0137 "One License" (hanzoai/hips, HIPs/hip-0137-one-license.md) puts BSD-3-Clause out of scope for hanzoai: original Hanzo work takes the standard MIT OR Apache-2.0 dual licence, and only forks keep an upstream licence. LICENSE is now the dual declaration; LICENSE-APACHE and LICENSE-MIT carry the two texts beside it. The existing copyright holder and years are preserved verbatim. Provenance: the big.Int core was written from scratch; the only dependency is hanzoai/decimal, relicensed identically. Eleven per-file BSD-3-Clause headers moved with it. Co-authored-by: Hanzo Dev <[email protected]>
25 lines
1.1 KiB
Go
25 lines
1.1 KiB
Go
// Copyright (c) 2026, Hanzo AI, Inc. MIT OR Apache-2.0.
|
|
|
|
package money
|
|
|
|
import "errors"
|
|
|
|
// Sentinel errors, matched with errors.Is.
|
|
var (
|
|
// ErrCurrencyMismatch is returned when an operation combines two different
|
|
// (non-zero) currencies.
|
|
ErrCurrencyMismatch = errors.New("money: currencies do not match")
|
|
// ErrUnknownCurrency is returned when a currency code/number is not in the registry.
|
|
ErrUnknownCurrency = errors.New("money: unknown currency")
|
|
// ErrInvalidAmount is returned when an amount string cannot be parsed.
|
|
ErrInvalidAmount = errors.New("money: invalid amount")
|
|
// ErrNoRate is returned when an exchange rate is missing.
|
|
ErrNoRate = errors.New("money: no exchange rate")
|
|
// ErrNonPositive is returned when a positive value was required (split parts, ratios).
|
|
ErrNonPositive = errors.New("money: value must be positive")
|
|
// ErrOverflow is returned when an exact value does not fit the requested
|
|
// machine type. It is never a rounded or truncated answer: a money conversion
|
|
// that silently wraps reports a balance nobody holds.
|
|
ErrOverflow = errors.New("money: value does not fit an int64")
|
|
)
|