File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 11<?php
22
3-
43namespace Verseles \Flyclone \Exception ;
54
5+ use Symfony \Component \Process \Exception \ProcessTimedOutException as SymfonyProcessTimedOutException ;
66
77class ProcessTimedOutException extends RcloneException
88{
9- public function __construct (\Exception $ exception , string $ message = 'The process took more than defined. ' , int $ code = 22 )
10- {
11- parent ::__construct ($ message , $ code , $ exception );
12- }
13- }
9+ /**
10+ * @param SymfonyProcessTimedOutException $exception The original exception from Symfony Process.
11+ * @param int $code The exception code.
12+ */
13+ public function __construct (SymfonyProcessTimedOutException $ exception , int $ code = 22 )
14+ {
15+ $ message = 'The process timed out. ' ; // Default message
16+
17+ // Determine which timeout was exceeded by inspecting the Symfony exception object.
18+ if ($ exception ->isIdleTimeout ()) {
19+ $ message = sprintf ('The process exceeded the idle timeout of %s seconds. ' , $ exception ->getIdleTimeout ());
20+ } elseif ($ exception ->isGeneralTimeout ()) {
21+ $ message = sprintf ('The process exceeded the total timeout of %s seconds. ' , $ exception ->getTimeout ());
22+ }
23+
24+ parent ::__construct ($ message , $ code , $ exception );
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments