Setting Property Constraint Error Message
Apologies if this is documented somewhere, or answered in another post. I can't seem to find it.
I have a property constraint that checks if a property name matches a particular regular expression. When the constraint fails, I want to set the error message to something sensible like "Property does not meet naming convention. Must be in the format..." rather than the generic message "Error: Property constraint violation for...". Is there a way to do this?
Thanks.
-jon
Please sign in to leave a comment.
Hi!
Try creating NonTypesystemRule instead of constraint. In this rule you can report errors/warnings by using
error "<message>" -> <node>;
warning ...;
expressions.
Perfect!
Thanks.
-jon
Why isn't this error command of the typesystem available in constraints? I don't know what property constraints should be used for, if it is not possible to report a more meaningful message as "Property constraint violation".