Note
We've packed up and moved from Confluence to Discourse to bring you a better, more interactive space. Out of courtesy we didn't migrate your user account so - you will have to signup again
The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe
Hello.
i externalized scripts and so far it works. I like to externalize a validation script which can throw an exception. But when this scripts should throws the exception, nothing happens: "throw new IssueTrackerException(message)"
The exception does not stop the synchronisation. (but i can see the message in the log which my script produces )
What do i do wrong?
Cheers Adrian
Adrian
---------------------------------------------------------
Incoming Rules:
Validate_IssueTypes.validate(issue, replica, connection)
// Core Field Mappings
issue.project = replica.project
issue.type = replica.type
issue.status = replica.status
SyncField_Summary.receive(issue, replica)
SyncField_Description.receive(issue, replica)
SyncField_Comment.receive(issue, replica, commentHelper)
---------------------------------------------------------
Script :
import org.slf4j.Logger
import com.exalate.api.exception.IssueTrackerException
class Validate_IssueTypes {
static validate(issue, replica, connection) {
String message
def allowedIssueTypes = ['Task', 'Story', 'Bug']
def log = org.slf4j.LoggerFactory.getLogger("com.exalate")
if (!allowedIssueTypes.contains(replica.type.name)) {
message = "Assert Issue-Types | " +
"Connection = '" + connection.name + "' | " +
"Rule = 'ruleName' | " +
"Issue-Type = '" + replica.type.name + "' is not allowed. " +
"The issue with key '" + replica.key + "' will not be synchronized to hosting-zone. " +
"Check the trigger, the issue type should be excluded from synch trigger !"
log.error(message)
throw new IssueTrackerException(message)
}
}
}
Hello, Adrian Suter, what happens if you wrap the entire Incoming rules with a
Regards, Serhiy.