Throw exception when input is empty.