Skip to content

Commit e1ee93f

Browse files
committed
Fix Call to a member function getCode() on string for convert method in currency model
1 parent 58f3cdc commit e1ee93f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/code/Magento/Directory/Model/Currency.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,13 @@ public function convert($price, $toCurrency = null)
233233
return $price * $rate;
234234
}
235235

236-
throw new \Exception(__('Undefined rate from "%1-%2".', $this->getCode(), $toCurrency->getCode()));
236+
throw new \Exception(
237+
__(
238+
'Undefined rate from "%1-%2".',
239+
$this->getCode(),
240+
(is_string($toCurrency)) ? $toCurrency : $toCurrency->getCode()
241+
)
242+
);
237243
}
238244

239245
/**

0 commit comments

Comments
 (0)