neatened up getErrorMessage