Prints error message according to given input.