Skip to content

Commit 302712a

Browse files
author
Stanislav Idolov
authored
ENGCOM-2552: [Backport] Improve "Invalid country code" error message on tax import #17160
2 parents 9317c4f + 282f756 commit 302712a

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
@@ -234,7 +234,7 @@ protected function _importRate(array $rateData, array $regionsCache, array $stor
234234
$countryCode = $rateData[1];
235235
$country = $this->_countryFactory->create()->loadByCode($countryCode, 'iso2_code');
236236
if (!$country->getId()) {
237-
throw new \Magento\Framework\Exception\LocalizedException(__('One of the countries has invalid code.'));
237+
throw new \Magento\Framework\Exception\LocalizedException(__('Country code is invalid: %1', $countryCode));
238238
}
239239
$regionsCache = $this->_addCountryRegionsToCache($countryCode, $regionsCache);
240240

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)