File tree Expand file tree Collapse file tree 2 files changed +0
-175
lines changed Expand file tree Collapse file tree 2 files changed +0
-175
lines changed Original file line number Diff line number Diff line change 8
8
namespace Magento \CloudPatches \Shell \Command ;
9
9
10
10
use Magento \CloudPatches \Patch \PatchCommandException ;
11
- use Throwable ;
12
11
13
12
/**
14
13
* Patch command driver exception
15
14
*/
16
15
class DriverException extends PatchCommandException
17
16
{
18
- /**
19
- * @param string $message
20
- * @param int $code
21
- * @param Throwable|null $previous
22
- */
23
- public function __construct (string $ message , int $ code = 0 , Throwable $ previous = null )
24
- {
25
- parent ::__construct ($ this ->formatMessage ($ message ), $ code , $ previous );
26
- }
27
-
28
- /**
29
- * Format error message
30
- *
31
- * @param string $message
32
- * @return string
33
- */
34
- private function formatMessage (string $ message ): string
35
- {
36
- $ result = $ message ;
37
- $ errorMsg = null ;
38
- $ generalMsg = null ;
39
- if (preg_match ('#^.*?Error Output:(?<errors>.*?)$#is ' , $ result , $ matches )) {
40
- $ errorMsg = 'Error Output: ' . $ matches ['errors ' ];
41
- $ result = str_replace ($ errorMsg , '' , $ result );
42
- if (!trim (str_replace ('= ' , '' , $ matches ['errors ' ]))) {
43
- $ errorMsg = null ;
44
- }
45
- }
46
- if (empty ($ errorMsg ) && preg_match ('#^.*?Output:(?<errors>.*?)$#is ' , $ result , $ matches )) {
47
- $ generalMsg = 'Output: ' . $ matches ['errors ' ];
48
- if (!trim (str_replace ('= ' , '' , $ matches ['errors ' ]))) {
49
- $ generalMsg = null ;
50
- }
51
- }
52
-
53
- return $ errorMsg ?? $ generalMsg ?? $ message ;
54
- }
55
17
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments