隐藏/自定义此php错误的最佳方法

i have this code which works fine

$done_getting = file_get_contents($url);

if($done_getting == !null) {
    return $done_getting;
} else { 
    return $custom_error_msg;
}

if i'm online it fetches $url and displays well on page, but in the event of a slow internet connection or I am offline I get

Warning: file_get_contents(url ): failed to open stream: HTTP request failed! in xxxxxx

This is the correct error msg from php , how do i customise this msg instead of getting this one as it tells the user were my root files are.

Is it possible to customise it.

I am using this in wordpress(debug mode). the code above works too, so when there is an error it returns $custom_error_msg but only after showing the default php error.