Tell whether invariant violation was before or after
This merge request makes the message that appears when an invariant is violated tell whether it happened before or after function execution. This makes it much easier to figure out where is the violation cause.