[lit] Use more modern syntax for constructing exceptions.