Handle some classes of bogus input by wrapping various conditions in
try/except blocks.