Split error message generation to erro

Added max validator as well