File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
app/code/Magento/CustomerGraphQl/Model/Resolver
dev/tests/api-functional/testsuite/Magento/GraphQl/Customer Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 2020use Magento \CustomerGraphQl \Model \Customer \ExtractCustomerData ;
2121use Magento \Framework \Exception \State \InputMismatchException ;
2222use Magento \Framework \Exception \State \InvalidTransitionException ;
23+ use Magento \Framework \Exception \StateException ;
2324use Magento \Framework \GraphQl \Config \Element \Field ;
2425use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
2526use Magento \Framework \GraphQl \Query \Resolver \Value ;
@@ -66,13 +67,15 @@ public function resolve(
6667 if (!$ this ->emailValidator ->isValid ($ args ['input ' ]['email ' ])) {
6768 throw new GraphQlInputException (__ ('Email is invalid ' ));
6869 }
69-
7070 try {
7171 $ customer = $ this ->accountManagement ->activate ($ args ['input ' ]['email ' ], $ args ['input ' ]['confirmation_key ' ]);
7272 } catch (InvalidTransitionException | InputMismatchException $ e ) {
73- throw new GraphQlInputException (__ ($ e ->getMessage ()));
73+ throw new GraphQlInputException (__ ($ e ->getRawMessage ()));
74+ } catch (StateException ) {
75+ throw new GraphQlInputException (__ ('This confirmation key is invalid or has expired. ' ));
76+ } catch (\Exception ) {
77+ throw new GraphQlInputException (__ ('There was an error confirming the account ' ));
7478 }
75-
7679 return ['customer ' => $ this ->extractCustomerData ->execute ($ customer )];
7780 }
7881}
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ public function testConfirmEmail()
106106 public function testConfirmEmailWrongEmail ()
107107 {
108108 $ this ->expectException (\Exception::class);
109+ $ this ->expectExceptionMessage ('Email is invalid ' );
109110
110111 $ this ->graphQlMutation (
111112 sprintf (
@@ -126,6 +127,7 @@ public function testConfirmEmailWrongEmail()
126127 public function testConfirmEmailWrongConfirmation ()
127128 {
128129 $ this ->expectException (\Exception::class);
130+ $ this ->expectExceptionMessage ('The confirmation token is invalid. Verify the token and try again. ' );
129131
130132 $ this ->graphQlMutation (
131133 sprintf (
You can’t perform that action at this time.
0 commit comments