handle both exceptions and errors in validating