Updated the thrown Exception to InvalidInputException

Also updated the try/catch block to use this same exception, so any
other exceptions are not accidentally caught.