How to raise an "InvalidInputException" in a Custom listener

Peter Sonntag May 17, 2018

I want to do an automatic validation check on some fields when creating/updating an issue.

I created an custom listener, selected the relevant projects and events.

However in this simplified script:

import com.opensymphony.workflow.InvalidInputException
throw new InvalidInputException("Input not valid")

crashes with the following error message:

2018-05-17 10:03:44,565 DEBUG [runner.WithPluginCompilationCustomiser]: Compile Script15.groovy, to node: Script15
2018-05-17 10:03:44,565 DEBUG [runner.WithPluginCompilationCustomiser]: Compile Script15.groovy, to node: Script15
2018-05-17 10:03:44,831 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2018-05-17 10:03:44,831 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2018-05-17 10:03:44,831 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: <inline script>
[InvalidInputException: [Error map: [{}]] [Error list: [[Input not valid]]]
	at Script15.run(Script15.groovy:7)
2018-05-17 10:03:44,831 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: <inline script>
[InvalidInputException: [Error map: [{}]] [Error list: [[Input not valid]]]
	at Script15.run(Script15.groovy:7)

Scriptrunner 5.3.26
Jira: 7.5.3

1 answer

1 accepted

4 votes
Answer accepted
Roland Holban (Adaptavist)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2018

Your listener is correctly throwing the exception. That is the error you see in the console.

Vineela Durbha February 11, 2019

Hi @Roland Holban (Adaptavist)

How to show this exception on jira UI ? 

I am writing similar code above but the exception is not being shown on ui when i perform issue updated event

Like # people like this
Teja June 27, 2019

@Roland Holban (Adaptavist) Any answer for this legit question.

Quinton Lephoto July 24, 2019

@Ronand Holban

answer please.

Teja July 25, 2019

@Quinton Lephoto  

You can find answer here.

- Tejas

Like Quinton Lephoto likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events