[PHP-WEBMASTER] [web-downloads] main: Fix error handling in FetchArtifact

Author: Shivam Mathur (shivammathur)
Date: 2026-04-02T06:09:26+05:30

Commit: Fix error handling in FetchArtifact · php/web-downloads@f6823ed · GitHub
Raw diff: https://github.com/php/web-downloads/commit/f6823ed7394b1646f4c4e6541548f8eb07fe9d19.diff

Fix error handling in FetchArtifact

Changed paths:
  M src/Actions/FetchArtifact.php

Diff:

diff --git a/src/Actions/FetchArtifact.php b/src/Actions/FetchArtifact.php
index c8f3203..03b70fd 100644
--- a/src/Actions/FetchArtifact.php
+++ b/src/Actions/FetchArtifact.php
@@ -23,8 +23,13 @@ public function handle($url, $filepath, #[\SensitiveParameter] $token = null): v
             }
             curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
         }
- curl_exec($ch);
+ $result = curl_exec($ch);
+ $error = curl_error($ch);
         curl_close($ch);
         fclose($fp);
+ if ($result === false) {
+ unlink($filepath);
+ throw new \RuntimeException('cURL error: ' . $error);
+ }
     }
}
\ No newline at end of file