Alternative for AgileDSLException
Hi,
When trying to stop autopromotion of a workflow, i am currently using “throw new AgileDSLException”.
Is there an alternate way I can stop the autopromotion and show a message to user?
Easy – just throw a regular exception. This is kind of what I use. Let me know if it doesn’t work for you.
try {
//condition 1
//must use -Pre, Synchronous, and Stop event subscriber settings and an equivalent catch block
Boolean valid = false
if (!valid) {
throw new Exception (“Hi, your ECO failed validation checks because of some reason. Please fix.”)
}
} catch (Exception ex) {
obj.logMonitor(ex.getMessage().toString());
throw new AgileDSLException(ex);
}
Hi Nikhil,
If you’re using Groovy, then yes, you have to throw DSLException to stop the promotion of workflow status if a condition is not satisfied or some error happens and propagate the message to users. There’s no other way than throwing the exception.