Use invalid_argument instead of IllegalArgumentException

Change-Id: I614713e7b6385f87fd041aefb1d4652cea1019a1