There's an Invalid_argument handler below, but your solution is cleaner.