10
10
use Magento \Framework \Module \ModuleList ;
11
11
use Magento \Framework \ObjectManagerInterface ;
12
12
use Magento \Framework \Phrase ;
13
- use Magento \Framework \Setup \Exception ;
13
+ use Magento \Framework \Setup \Exception as SetupException ;
14
14
use Magento \Framework \Setup \ModuleDataSetupInterface ;
15
15
16
16
/**
@@ -129,8 +129,8 @@ public function __construct(
129
129
/**
130
130
* Apply all patches for one module
131
131
*
132
- * @param null | string $moduleName
133
- * @throws Exception
132
+ * @param null| string $moduleName
133
+ * @throws SetupException
134
134
*/
135
135
public function applyDataPatch ($ moduleName = null )
136
136
{
@@ -149,7 +149,7 @@ public function applyDataPatch($moduleName = null)
149
149
['moduleDataSetup ' => $ this ->moduleDataSetup ]
150
150
);
151
151
if (!$ dataPatch instanceof DataPatchInterface) {
152
- throw new Exception (
152
+ throw new SetupException (
153
153
new Phrase ("Patch %1 should implement DataPatchInterface " , [get_class ($ dataPatch )])
154
154
);
155
155
}
@@ -164,7 +164,7 @@ public function applyDataPatch($moduleName = null)
164
164
$ this ->moduleDataSetup ->getConnection ()->commit ();
165
165
} catch (\Exception $ e ) {
166
166
$ this ->moduleDataSetup ->getConnection ()->rollBack ();
167
- throw new Exception (
167
+ throw new SetupException (
168
168
new Phrase (
169
169
'Unable to apply data patch %1 for module %2. Original exception message: %3 ' ,
170
170
[
@@ -183,8 +183,7 @@ public function applyDataPatch($moduleName = null)
183
183
}
184
184
185
185
/**
186
- * Register all patches in registry in order to manipulate chains and dependencies of patches
187
- * of patches
186
+ * Register all patches in registry in order to manipulate chains and dependencies of patches of patches
188
187
*
189
188
* @param string $moduleName
190
189
* @param string $patchType
@@ -217,8 +216,8 @@ private function prepareRegistry($moduleName, $patchType)
217
216
*
218
217
* Please note: that schema patches are not revertable
219
218
*
220
- * @param null | string $moduleName
221
- * @throws Exception
219
+ * @param null| string $moduleName
220
+ * @throws SetupException
222
221
*/
223
222
public function applySchemaPatch ($ moduleName = null )
224
223
{
@@ -239,7 +238,7 @@ public function applySchemaPatch($moduleName = null)
239
238
$ schemaPatch ->apply ();
240
239
$ this ->patchHistory ->fixPatch (get_class ($ schemaPatch ));
241
240
} catch (\Exception $ e ) {
242
- throw new Exception (
241
+ throw new SetupException (
243
242
new Phrase (
244
243
'Unable to apply patch %1 for module %2. Original exception message: %3 ' ,
245
244
[
@@ -258,8 +257,8 @@ public function applySchemaPatch($moduleName = null)
258
257
/**
259
258
* Revert data patches for specific module
260
259
*
261
- * @param null | string $moduleName
262
- * @throws Exception
260
+ * @param null| string $moduleName
261
+ * @throws SetupException
263
262
*/
264
263
public function revertDataPatches ($ moduleName = null )
265
264
{
@@ -280,7 +279,7 @@ public function revertDataPatches($moduleName = null)
280
279
$ adapter ->commit ();
281
280
} catch (\Exception $ e ) {
282
281
$ adapter ->rollBack ();
283
- throw new Exception (new Phrase ($ e ->getMessage ()));
282
+ throw new SetupException (new Phrase ($ e ->getMessage ()));
284
283
} finally {
285
284
unset($ dataPatch );
286
285
}
0 commit comments