Skip to content

[Forwardport] Improve "Invalid country code" error message on tax import #16961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected function _importRate(array $rateData, array $regionsCache, array $stor
$countryCode = $rateData[1];
$country = $this->_countryFactory->create()->loadByCode($countryCode, 'iso2_code');
if (!$country->getId()) {
throw new \Magento\Framework\Exception\LocalizedException(__('One of the countries has invalid code.'));
throw new \Magento\Framework\Exception\LocalizedException(__('Country code is invalid: %1', $countryCode));
}
$regionsCache = $this->_addCountryRegionsToCache($countryCode, $regionsCache);

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/TaxImportExport/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Rate,Rate
"Invalid file upload attempt","Invalid file upload attempt"
"Invalid file upload attempt.","Invalid file upload attempt."
"Invalid file format.","Invalid file format."
"One of the countries has invalid code.","One of the countries has invalid code."
"Country code is invalid: %1","Country code is invalid: %1"
"Import Tax Rates","Import Tax Rates"
"Export Tax Rates","Export Tax Rates"
CSV,CSV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testImportFromCsvFileWithCorrectData()
/**
* @magentoDbIsolation enabled
* @expectedException \Magento\Framework\Exception\LocalizedException
* @expectedExceptionMessage One of the countries has invalid code.
* @expectedExceptionMessage Country code is invalid: ZZ
*/
public function testImportFromCsvFileThrowsExceptionWhenCountryCodeIsInvalid()
{
Expand Down