SERVER-9518 Catch exceptions in ExternalState functions