Skip to content

Commit 78aa602

Browse files
ENGCOM-2386: Improve "Invalid country code" error message on tax import #16873
2 parents 73cf4a8 + 4467c15 commit 78aa602

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/code/Magento/TaxImportExport/Model/Rate/CsvImportHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ protected function _importRate(array $rateData, array $regionsCache, array $stor
237237
$countryCode = $rateData[1];
238238
$country = $this->_countryFactory->create()->loadByCode($countryCode, 'iso2_code');
239239
if (!$country->getId()) {
240-
throw new \Magento\Framework\Exception\LocalizedException(__('One of the countries has invalid code.'));
240+
throw new \Magento\Framework\Exception\LocalizedException(__('Country code is invalid: %1', $countryCode));
241241
}
242242
$regionsCache = $this->_addCountryRegionsToCache($countryCode, $regionsCache);
243243

app/code/Magento/TaxImportExport/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Rate,Rate
1212
"Invalid file upload attempt","Invalid file upload attempt"
1313
"Invalid file upload attempt.","Invalid file upload attempt."
1414
"Invalid file format.","Invalid file format."
15-
"One of the countries has invalid code.","One of the countries has invalid code."
15+
"Country code is invalid: %1","Country code is invalid: %1"
1616
"Import Tax Rates","Import Tax Rates"
1717
"Export Tax Rates","Export Tax Rates"
1818
CSV,CSV

dev/tests/integration/testsuite/Magento/TaxImportExport/Model/Rate/CsvImportHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testImportFromCsvFileWithCorrectData()
5757
/**
5858
* @magentoDbIsolation enabled
5959
* @expectedException \Magento\Framework\Exception\LocalizedException
60-
* @expectedExceptionMessage One of the countries has invalid code.
60+
* @expectedExceptionMessage Country code is invalid: ZZ
6161
*/
6262
public function testImportFromCsvFileThrowsExceptionWhenCountryCodeIsInvalid()
6363
{

0 commit comments

Comments
 (0)