File tree Expand file tree Collapse file tree 4 files changed +23
-11
lines changed
app/code/Magento/Customer/Model
dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass
lib/internal/Magento/Framework/Exception/Customer Expand file tree Collapse file tree 4 files changed +23
-11
lines changed Original file line number Diff line number Diff line change 24
24
use Magento \Framework \Exception \EmailNotConfirmedException ;
25
25
use Magento \Framework \Exception \InputException ;
26
26
use Magento \Framework \Exception \InvalidEmailOrPasswordException ;
27
+ use Magento \Framework \Exception \LocalizedException ;
27
28
use Magento \Framework \Exception \NoSuchEntityException ;
28
29
use Magento \Framework \Exception \State \ExpiredException ;
29
30
use Magento \Framework \Exception \State \InputMismatchException ;
@@ -511,10 +512,9 @@ public function createAccountWithPasswordHash(
511
512
try {
512
513
// If customer exists existing hash will be used by Repository
513
514
$ customer = $ this ->customerRepository ->save ($ customer , $ hash );
514
- } catch (\Magento \Customer \Exception $ e ) {
515
- if ($ e ->getCode () === CustomerModel::EXCEPTION_EMAIL_EXISTS ) {
516
- throw new InputMismatchException ('Customer with the same email already exists in associated website. ' );
517
- }
515
+ } catch (\Magento \Framework \Exception \Customer \Exception $ e ) {
516
+ throw new InputMismatchException ('Customer with the same email already exists in associated website. ' );
517
+ } catch (LocalizedException $ e ) {
518
518
throw $ e ;
519
519
}
520
520
Original file line number Diff line number Diff line change @@ -92,7 +92,8 @@ protected function _getDefaultAttributes()
92
92
*
93
93
* @param \Magento\Framework\Object $customer
94
94
* @return $this
95
- * @throws \Magento\Customer\Exception
95
+ * @throws \Magento\Framework\Exception\Customer\Exception
96
+ * @throws \Magento\Framework\Validator\ValidatorException
96
97
* @throws \Magento\Framework\Model\Exception
97
98
*/
98
99
protected function _beforeSave (\Magento \Framework \Object $ customer )
@@ -101,7 +102,7 @@ protected function _beforeSave(\Magento\Framework\Object $customer)
101
102
parent ::_beforeSave ($ customer );
102
103
103
104
if (!$ customer ->getEmail ()) {
104
- throw new \Magento \Customer \Exception (__ ('Customer email is required ' ));
105
+ throw new \Magento \Framework \ Exception \ Customer \Exception (__ ('Customer email is required ' ));
105
106
}
106
107
107
108
$ adapter = $ this ->_getWriteAdapter ();
@@ -124,9 +125,8 @@ protected function _beforeSave(\Magento\Framework\Object $customer)
124
125
125
126
$ result = $ adapter ->fetchOne ($ select , $ bind );
126
127
if ($ result ) {
127
- throw new \Magento \Customer \Exception (
128
- __ ('Customer with the same email already exists in associated website. ' ),
129
- \Magento \Customer \Model \Customer::EXCEPTION_EMAIL_EXISTS
128
+ throw new \Magento \Framework \Exception \Customer \Exception (
129
+ __ ('Customer with the same email already exists in associated website. ' )
130
130
);
131
131
}
132
132
Original file line number Diff line number Diff line change @@ -66,8 +66,8 @@ public function testSave()
66
66
67
67
/**
68
68
* @magentoDbIsolation enabled
69
- * @expectedException \Magento\Framework\Exception\InputException
70
- * @expectedExceptionMessage A class with the same name already exists for ClassType PRODUCT .
69
+ * @expectedException \Magento\Framework\Exception\AlreadyExistsException
70
+ * @expectedExceptionMessage Class name and class type already exists.
71
71
*/
72
72
public function testSaveThrowsExceptionIfGivenTaxClassNameIsNotUnique ()
73
73
{
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2015 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Framework \Exception \Customer ;
7
+
8
+ use Magento \Framework \Exception \LocalizedException ;
9
+
10
+ class Exception extends LocalizedException
11
+ {
12
+ }
You can’t perform that action at this time.
0 commit comments