Override __outputter__ when functions trigger exceptions (2014.1 branch)

This is #11464, cherrypicked for 2014.1.