---
title: "Exceptions — Money for Laravel | Roundly"
description: "One MoneyException base class and a typed exception for every failure — mismatched currencies, rounding, overflow, rates and config."
url: https://roundly-consulting.com/open-source/docs/money-for-laravel/exceptions
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Money for Laravel](https://roundly-consulting.com/open-source/docs/money-for-laravel.md)

# Exceptions

Every exception extends the abstract RoundlyConsulting\\Money\\Exceptions\\MoneyException (a RuntimeException), so one catch covers the whole family. Messages are developer-facing English; the translatable surface is the validation messages.

```php
use RoundlyConsulting\Money\Exceptions\CurrencyMismatch;
use RoundlyConsulting\Money\Exceptions\MoneyException;

try {
    $total = $cartTotal->add($shippingFee);
} catch (CurrencyMismatch $e) {
    // mixing currencies is a bug, not a conversion
} catch (MoneyException $e) {
    // one catch for the whole family
}
```

| Exception | Thrown when |
| --- | --- |
| `CurrencyMismatch` | Arithmetic or ordering across currencies; a shared cast column would be re-denominated; a discount, cap, shipping or rate in another currency. |
| `UnknownCurrency` | A code the registry does not know. |
| `InvalidCurrency` | An invalid Currency definition; a custom code longer than schema.currency\_length. |
| `CurrencyAlreadyRegistered` | A duplicate registration without replace; any ISO redefinition. |
| `InvalidAmount` | Malformed or over-long input, unrecoverable floats, ambiguous parser symbols, tampered payloads. |
| `RoundingNecessary` | Input more precise than the target scale, without a rounding mode. |
| `AmountOverflow` | A result beyond 65 digits; minorInt() outside int64. |
| `DivisionByZero` | Dividing by zero, or ratioTo() a zero amount. |
| `InvalidAllocation` | Bad allocate(), split() or allocator input. |
| `EmptyMoneyCollection` | sum() without a currency, or min(), max(), average() of nothing. |
| `InvalidMoneyValue` | Cast, resource or Blade misuse; corrupt stored data; precision or engine range exceeded. |
| `InvalidPercentage` | A negative or over-precise percentage. |
| `InvalidRatio` | A zero denominator, inverting zero, or terms beyond 80 digits. |
| `InvalidDiscount` | Invalid discounts and discount allocations. |
| `InvalidMoneyConfiguration` | Misconfiguration, detected at the point of use. |
| `FormatterUnavailable` | formatting.driver = intl without ext-intl. |
| `ExchangeRateUnavailable` | No rate, a stale rate, a future date or a failed chain. |
| `ExchangeRateFetchFailed` | The ECB feed could not be read — HTTP error, timeout, malformed or oversized body. |
| `InvalidExchangeRate` | A non-positive rate, a same-currency rate other than 1, or a rate without an exact decimal of up to 40 characters. |

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/money-for-laravel.md)
