I'd seriously *hate* to abuse invariants for that. The job of invariants is to give guarantees about state - not to manage e.g. allocations, creations, cleanups, etc. "Has something properly succeeded and if not is there cleanup needed?" is the job of scope and possibly (but ugly and non-elegantly) exceptions.