Only allow generation if there are no errors in input model

Hi all,

I am looking for a way to disallow generation if there are still errors in the user models (constrain violations, typesystem, checking rules, etc.). Unfortunately I cannot find a way to check models or nodes for the existence of errors. Is there some easy way to access this information (e.g. in the 'is applicable' condition of a generator)? Thanks!




Would it be sufficient for you to use the MPS setting under "MPS->Preferences->Build, Execution, Deployment->Generator" where you can enforce a model check before generation, or do you want this option to be available for a specific generator only?


Thanks for the suggestion. I already use this option and it works as intended, however this does not enable me to react to the user trying to generate a faulty model (e.g. giving an additional contextual message).

Further, the 'preview generated text' option bypasses this check, leaving users with cryptic error messages not related to the actual errors in the models (which I'd love to avoid). Also preview generated text can also show no generation error at all (e.g. when there are 'only' typesystem errors). :/

Any other ideas?


The generator can report errors to the user through the "genContext" object.


Please sign in to leave a comment.