Site icon Hip-Hop Website Design and Development

is_wp_error is missing error

I am getting the following error in the code snippet below—and pointing to the line that references the $result[ ‘body’ ] assignment. The is_wp_error should have caught the error. ??????????????

Fatal error: Cannot use object of type WP_Error as array

    $result = wp_remote_post( ..... ) );
if( is_wp_error( $result ) ):
    $display = 'Error Message';
else:
    $display = $result[ 'body' ];
endif;