Good question! I thought about this a while back and decided against adding it.
The reason for that was that assertions in triggers work quite different from assertions in choices. In choices, assertions are commonly used for input validation. If the input does not match the assertion, your transaction is aborted. In that setting, it is absolutely valid for the assertion to fail.
In triggers the situation is a bit different. Here assertions behave more like assertions in general-purpose languages like Java,C++,…. If they fail your trigger will crash so those are assertions that should never fail.
If you really want your trigger to crash, you can call error
.
That said, while these were my thoughts originally around not adding it, I’m very interested in hearing other people’s thoughts. If we’re not worried about people having the wrong expectation around assert
, we could definitely add it.