Skip to content

Commit b7cd30c

Browse files
authored
Merge pull request #41 from newfold-labs/minor-fixes
fallback to original site description if we get an error in refining
2 parents 382a7ef + c69bb4e commit b7cd30c

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

includes/SiteGen/SiteGen.php

+1-23
Original file line numberDiff line numberDiff line change
@@ -86,36 +86,14 @@ private static function get_refined_site_description( $site_description ) {
8686
array(
8787
'hiivetoken' => HiiveConnection::get_auth_token(),
8888
'prompt' => $site_description,
89-
'identifier' => $identifier,
9089
)
9190
),
9291
)
9392
);
9493

9594
$response_code = wp_remote_retrieve_response_code( $response );
9695
if ( 200 !== $response_code ) {
97-
if ( 400 === $response_code ) {
98-
$error = json_decode( wp_remote_retrieve_body( $response ), true );
99-
return array(
100-
'error' => $error['payload']['reason'],
101-
);
102-
}
103-
try {
104-
$error = json_decode( wp_remote_retrieve_body( $response ), true );
105-
if ( array_key_exists( 'payload', $error ) ) {
106-
return array(
107-
'error' => $error['payload'],
108-
);
109-
} else {
110-
return array(
111-
'error' => __( 'We are unable to process the request at this moment' ),
112-
);
113-
}
114-
} catch ( \Exception $exception ) {
115-
return array(
116-
'error' => __( 'We are unable to process the request at this moment' ),
117-
);
118-
}
96+
return $site_description;
11997
}
12098

12199
$refined_description = json_decode( wp_remote_retrieve_body( $response ), true );

0 commit comments

Comments
 (0)