I am a “little late” but this solution worked great for me. It will show the div only if the caption is not empty.
<?php
$get_description = get_post(get_post_thumbnail_id())->post_excerpt;
the_post_thumbnail();
if(!empty($get_description)){//If description is not empty show the div
echo '<div class="featured_caption">' . $get_description . '</div>';
}
?>