use exception for class invariance