new method for creating error messages