I RTM but I couldn't find any nice answer to this question, so here is it:
RTM
set_error_handler('error::function')