diff --git a/includes/class-integration.php b/includes/class-integration.php index 1ccd6266daa0499f4582363802067a976d1f46c8..18d3175ba853dfd84232115bf47a2bd74263a493 100644 --- a/includes/class-integration.php +++ b/includes/class-integration.php @@ -52,7 +52,7 @@ abstract class Integration extends Singleton $response = Wpct_Http_Client::post_multipart($url, $data, $uploads); } - $success = $success && (bool) $response; + $success = $success && !is_wp_error($response); } } @@ -65,8 +65,9 @@ abstract class Integration extends Singleton $to = $email; $subject = 'Wpct ERP Forms Error'; $body = "Form ID: {$form_data['id']}\n"; - $body .= "Form title: {$form_data['title']}"; - $body .= 'Submission: ' . print_r($payload, true); + $body .= "Form title: {$form_data['title']}\n"; + $body .= 'Submission: ' . print_r($payload, true) . "\n"; + $body .= 'Error: ' . print_r($response->get_error_data(), true) . "\n"; $success = wp_mail($to, $subject, $body); if (!$success) { throw new Exception('Error while submitting form ' . $form_data['id']); @@ -203,7 +204,7 @@ abstract class Integration extends Singleton ]); $res = Wpct_Http_Client::post($url, $payload); - if (!$res) { + if (is_wp_error($res)) { throw new Exception('Error while establish RPC session'); } diff --git a/wpct-http-bridge b/wpct-http-bridge index 98b6d9e3729ef61c1c7fafd73e23f793633d2062..a94c92d29df6045583191097ba3fd5191636cac2 160000 --- a/wpct-http-bridge +++ b/wpct-http-bridge @@ -1 +1 @@ -Subproject commit 98b6d9e3729ef61c1c7fafd73e23f793633d2062 +Subproject commit a94c92d29df6045583191097ba3fd5191636cac2