Error function and stop function selection.