This is a clean way to do it, this is the purpose of exceptions.