如何抛出异常,因为该问题在 ScriptRunner postfunction 中没有组件

问题描述 投票:0回答:1

我正在使用 Scriptrunner,我想抛出异常,因为该问题没有组件,如下所示:

我怎样才能做到这一点?

我正在使用以下代码,我正在检查组件是否为空,但不会引发错误。我该如何解决这个问题?

package SuperFeature

import com.opensymphony.workflow.WorkflowException

def components = issue.components

log.warn("MOUNA COMPONENTS "+components)

if(components.empty) {

         log.warn("MOUNA EMPTY")

          throw new WorkflowException("Issue does not have components")

}
jira jira-rest-api jira-plugin jira-rest-java-api scriptrunner-for-jira
1个回答
0
投票

当您使用ScriptEunner WEB Console时,您应该返回一些值,抛出异常在大多数情况下不起作用。您可以以中断/停止操作或返回 false/null/等的方式构建脚本代码。取决于谁是错误/异常的使用者。

© www.soinside.com 2019 - 2024. All rights reserved.