@@ -54,7 +54,16 @@ public function handle(): void
5454 $ connection = $ this ->site ->connection ;
5555
5656 // Test connection and get current version
57- $ healthResult = $ connection ->checkHealth ();
57+ try {
58+ $ healthResult = $ connection ->checkHealth ();
59+ } catch (\Throwable $ e ) {
60+ throw new UpdateException (
61+ "checkHealth " ,
62+ "Health check failed " ,
63+ (int ) $ e ->getCode (),
64+ $ e instanceof \Exception ? $ e : null
65+ );
66+ }
5867
5968 // Check the version
6069 if (version_compare ($ healthResult ->cms_version , $ this ->targetVersion , ">= " )) {
@@ -106,7 +115,16 @@ public function handle(): void
106115 return ;
107116 }
108117
109- $ prepareResult = $ connection ->prepareUpdate (["targetVersion " => $ this ->targetVersion ]);
118+ try {
119+ $ prepareResult = $ connection ->prepareUpdate (["targetVersion " => $ this ->targetVersion ]);
120+ } catch (\Throwable $ e ) {
121+ throw new UpdateException (
122+ "prepareUpdate " ,
123+ "Prepare failed " ,
124+ (int ) $ e ->getCode (),
125+ $ e instanceof \Exception ? $ e : null
126+ );
127+ }
110128
111129 // Perform the actual extraction
112130 try {
@@ -213,10 +231,19 @@ public function failed(\Exception $exception): void
213231 $ connection = $ this ->site ->connection ;
214232
215233 // Get base execption information
216- $ failedStep = $ exception instanceof UpdateException ? $ exception ->getStep () : null ;
234+ $ failedStep = $ exception instanceof UpdateException ? $ exception ->getStep () : get_class ( $ exception ) ;
217235 $ failedMessage = $ exception ->getMessage ();
218236 $ failedTrace = $ exception ->getTraceAsString ();
219237
238+ // Log response body
239+ if ($ exception instanceof RequestException) {
240+ $ failedMessage .= "\n Response Body: " . $ exception ->getResponse ()->getBody ();
241+ }
242+
243+ if ($ exception ->getPrevious () instanceof RequestException) {
244+ $ failedMessage .= "\n Response Body: " . $ exception ->getPrevious ()->getResponse ()->getBody ();
245+ }
246+
220247 // Notify users
221248 try {
222249 $ connection ->notificationFailed (["fromVersion " => $ this ->site ->cms_version , "toVersion " => $ this ->targetVersion ]);
0 commit comments