Using InvalidArgumentException instead of Exception.