Include exception in custom constraints errors

This refactors constraints to use a shared base class that includes the
error message when validation errors happen.

Co-Authored-By: ala.rezmerita@cloudwatt.com
Closes-Bug: #1297371
Change-Id: Ia382f53d85d83c8c474ad8bda93c6d65f16cfca9
Merge "Include exception in custom constraints errors"