Skip to content

Commit 584d505

Browse files
swissspidyCopilot
andauthored
Update src/WP_CLI/CommandWithUpgrade.php
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3a4d190 commit 584d505

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

‎src/WP_CLI/CommandWithUpgrade.php‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,17 +1191,26 @@ protected function get_raw_url_from_gist( $gist_id ) {
11911191

11921192
if ( 403 === $response_code ) {
11931193
return new \WP_Error(
1194-
403,
1195-
$this->build_rate_limiting_error_message( $decoded_body )
1194+
'api_rate_limit',
1195+
$this->build_rate_limiting_error_message( $decoded_body ),
1196+
[ 'status' => 403 ]
11961197
);
11971198
}
11981199

11991200
if ( 404 === $response_code ) {
1200-
return new \WP_Error( 404, 'Gist not found.' );
1201+
return new \WP_Error(
1202+
'gist_not_found',
1203+
'Gist not found.',
1204+
[ 'status' => 404 ]
1205+
);
12011206
}
12021207

12031208
if ( null === $decoded_body || ! is_object( $decoded_body ) || ! isset( $decoded_body->files ) ) {
1204-
return new \WP_Error( 500, 'Invalid response from GitHub Gist API.' );
1209+
return new \WP_Error(
1210+
'invalid_gist_api_response',
1211+
'Invalid response from GitHub Gist API.',
1212+
[ 'status' => 500 ]
1213+
);
12051214
}
12061215

12071216
// Find PHP files in the gist

0 commit comments

Comments
 (0)