Throwing an error from a static constructor

Posted by rbf on 20-Feb-2009 04:06

I have created a class with a static constructor and other static members.

When I call a static method for the first time the constructor is executed. But when the constructor throws an error the static method is happily executed afterwards and of course miserably fails.

I would expect the invocation of the static method to return with an error before actually executing the code in the static method and any subsequent calls to the static 'class' to throw an error. That is what the documentation says should happen. Obviously I don't want to repeat all error checks in all static methods in that class. What am I missing?

All Replies

Posted by rbf on 20-Feb-2009 04:34

Never mind, I forgot to add the second parameter to my UNDO, THROW statement. This has bitten me before.

This thread is closed