Skip to content

Commit

Permalink
Handle post submit failures to Liaison API
Browse files Browse the repository at this point in the history
  • Loading branch information
inderpreet99 committed Apr 7, 2017
1 parent 0b6f005 commit cd5badd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bu-liaison-inquiry.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ function handle_liaison_inquiry() {
// Make the external API call.
$remote_submit = wp_remote_post( self::$submit_url, $post_args );

if ( is_wp_error( $remote_submit ) ) {
$return['status'] = 0;
$return['response'] = 'Failed submitting to Liaison API. Please retry. Error: ' . $remote_submit->get_error_message();
error_log( sprintf( '%s: %s', __METHOD__, $return['response'] ) );
echo json_encode( $return );
return;
}

// Decode the response and activate redirect to the personal url on success.
$resp = json_decode( $remote_submit['body'] );

Expand Down

0 comments on commit cd5badd

Please sign in to comment.