renamed and extracted error helper functions to play nice with others