diff --git a/includes/admin/class-algolia-admin.php b/includes/admin/class-algolia-admin.php index 4b237ddc..968ed1e6 100644 --- a/includes/admin/class-algolia-admin.php +++ b/includes/admin/class-algolia-admin.php @@ -272,7 +272,9 @@ public function re_index() { wp_send_json( $response ); } catch ( Exception $exception ) { - echo esc_html( $exception->getMessage() ); + wp_send_json( [ + 'responseText' => $exception->getMessage() + ] ); throw $exception; } } @@ -307,7 +309,9 @@ public function push_settings() { ); wp_send_json( $response ); } catch ( Exception $exception ) { - echo esc_html( $exception->getMessage() ); + wp_send_json( [ + 'responseText' => $exception->getMessage() + ] ); throw $exception; } }