Perhaps you could return an Either from the constructor, and then either have a special construct to handle Left:
myObj = new Object() :{ cleanup() }
or require dummy objects in case of failure: myObj = new Object() ?? new DummyObject()
Admittedly less than optimal. The more I think about it, the more I think it's a bad idea... The first still means that you need a separate catch block for each statement. The second is essentially swallowing the exception.Aside from that, using Either in the return kills your ability to do method chaining, unless you build method chaining into an operator and have it propagate the Either (similar to bind).