handle function calls that throw