diff --git a/src/Exceptions/CannotExtractCurrencyException.php b/src/Exceptions/CannotExtractCurrencyException.php new file mode 100644 index 0000000..74a92fe --- /dev/null +++ b/src/Exceptions/CannotExtractCurrencyException.php @@ -0,0 +1,15 @@ +suffix()) ) { if ($possibleCurrency) { - throw new \Exception('Multiple currencies are using the same prefix and suffix. Please specify the currency of the formatted string.'); + throw new CannotExtractCurrencyException('Multiple currencies are using the same prefix and suffix. Please specify the currency of the formatted string.'); } $possibleCurrency = $currency; } } - return $possibleCurrency ?? throw new \Exception('None of the currencies are using the prefix and suffix that would match with the formatted string.'); + return $possibleCurrency ?? throw new CannotExtractCurrencyException('None of the currencies are using the prefix and suffix that would match with the formatted string.'); } }