Skip to content

Commit e484fd0

Browse files
authored
Remove try-catch blocks (#39)
Hotfix
2 parents ac34bef + 20908ca commit e484fd0

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

src/MoneyServiceProvider.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,13 @@ public function boot()
2222
$this->registerPublishing();
2323
}
2424

25-
try {
26-
$settings = (new MoneySettings())
27-
->setDecimals(config('money.decimals', 1))
28-
->setThousandsSeparator(config('money.thousands_separator', ' '))
29-
->setDecimalSeparator(config('money.decimal_separator', '.'))
30-
->setEndsWith0(config('money.ends_with_0', false))
31-
->setHasSpaceBetween(config('money.space_between', true))
32-
->setOrigin(config('money.origin', MoneySettings::ORIGIN_INT));
33-
} catch (UndefinedOriginException $e) {
34-
dd($e->getMessage());
35-
}
25+
$settings = (new MoneySettings())
26+
->setDecimals(config('money.decimals', 1))
27+
->setThousandsSeparator(config('money.thousands_separator', ' '))
28+
->setDecimalSeparator(config('money.decimal_separator', '.'))
29+
->setEndsWith0(config('money.ends_with_0', false))
30+
->setHasSpaceBetween(config('money.space_between', true))
31+
->setOrigin(config('money.origin', MoneySettings::ORIGIN_INT));
3632

3733
Money::set($settings);
3834
}

src/MoneySettings.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,13 @@ public function __construct(
3636
$this->money = null;
3737
$this->origin = MoneySettings::ORIGIN_INT;
3838

39-
try {
40-
$this->setDecimals($decimals ?? Money::getDefaultDecimals())
41-
->setThousandsSeparator($thousands_separator ?? Money::getDefaultThousandsSeparator())
42-
->setDecimalSeparator($decimal_separator ?? Money::getDefaultDecimalSeparator())
43-
->setEndsWith0($ends_with_0 ?? Money::getDefaultEndsWith0())
44-
->setHasSpaceBetween($space_between ?? Money::getDefaultSpaceBetween())
45-
->setCurrency($currency ?? Currency::code(Currency::getConfigCurrency()))
46-
->setOrigin($origin ?? Money::getDefaultOrigin());
47-
} catch (CurrencyDoesNotExistException | ShouldPublishConfigFileException | UndefinedOriginException $e) {
48-
dd($e->getMessage());
49-
}
39+
$this->setDecimals($decimals ?? Money::getDefaultDecimals())
40+
->setThousandsSeparator($thousands_separator ?? Money::getDefaultThousandsSeparator())
41+
->setDecimalSeparator($decimal_separator ?? Money::getDefaultDecimalSeparator())
42+
->setEndsWith0($ends_with_0 ?? Money::getDefaultEndsWith0())
43+
->setHasSpaceBetween($space_between ?? Money::getDefaultSpaceBetween())
44+
->setCurrency($currency ?? Currency::code(Currency::getConfigCurrency()))
45+
->setOrigin($origin ?? Money::getDefaultOrigin());
5046
}
5147

5248
public function bind(Money $money): self

0 commit comments

Comments
 (0)