Skip to content

Commit 32ab1a8

Browse files
author
Yurii Torbyk
committed
MAGETWO-33814: Change parent class of Model\Exception sub-classes to Localized
1 parent dfd8de3 commit 32ab1a8

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

app/code/Magento/Integration/Service/V1/AdminTokenService.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,14 @@ public function __construct(
7272
public function createAdminAccessToken($username, $password)
7373
{
7474
$this->validatorHelper->validateCredentials($username, $password);
75-
try {
76-
$this->userModel->login($username, $password);
77-
if (!$this->userModel->getId()) {
78-
/*
79-
* This message is same as one thrown in \Magento\Backend\Model\Auth to keep the behavior consistent.
80-
* Constant cannot be created in Auth Model since it uses legacy translation that doesn't support it.
81-
* Need to make sure that this is refactored once exception handling is updated in Auth Model.
82-
*/
83-
throw new AuthenticationException('Please correct the user name or password.');
84-
}
85-
} catch (\Magento\Backend\Model\Auth\Exception $e) {
86-
throw new AuthenticationException($e->getMessage(), [], $e);
87-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
88-
throw new LocalizedException($e->getMessage(), [], $e);
75+
$this->userModel->login($username, $password);
76+
if (!$this->userModel->getId()) {
77+
/*
78+
* This message is same as one thrown in \Magento\Backend\Model\Auth to keep the behavior consistent.
79+
* Constant cannot be created in Auth Model since it uses legacy translation that doesn't support it.
80+
* Need to make sure that this is refactored once exception handling is updated in Auth Model.
81+
*/
82+
throw new AuthenticationException('Please correct the user name or password.');
8983
}
9084
return $this->tokenModelFactory->create()->createAdminToken($this->userModel->getId())->getToken();
9185
}

dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public function testSave()
6666

6767
/**
6868
* @magentoDbIsolation enabled
69-
* @expectedException \Magento\Framework\Exception\AlreadyExistsException
70-
* @expectedExceptionMessage Class name and class type already exists.
69+
* @expectedException \Magento\Framework\Exception\InputException
70+
* @expectedExceptionMessage A class with the same name already exists for ClassType PRODUCT.
7171
*/
7272
public function testSaveThrowsExceptionIfGivenTaxClassNameIsNotUnique()
7373
{

0 commit comments

Comments
 (0)