Skip to content

Commit

Permalink
JiraInstanceManagerRest.groovy (#50)
Browse files Browse the repository at this point in the history
* Improving error handling in executeLocalScriptFile()
  • Loading branch information
farthinder authored Apr 2, 2024
1 parent b2c298a commit 0c58fba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.eficode.atlassian</groupId>
<artifactId>jirainstancemanager</artifactId>
<version>2.1.3</version>
<version>2.1.4</version>
<description>A groovy library for interacting with Jira REST API.</description>

<properties>
Expand Down Expand Up @@ -74,7 +74,7 @@
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>4.0.8</version>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,12 @@ final class JiraInstanceManagerRest {

HttpResponse scriptResponse = rest.post("/rest/scriptrunner/latest/user/exec/").connectTimeout(4 * 60000).cookie(acquireWebSudoCookies()).contentType("application/json").body(["script": scriptContent]).asJson()

Map scriptResponseJson = scriptResponse.body.getObject().toMap()
Map scriptResponseJson = scriptResponse.body?.getObject()?.toMap()

if (!scriptResponseJson) {
log.warn("Error getting response after executing ScriptRunner Script, got body:" + scriptResponse.body?.toPrettyString())
}

ArrayList<String> logRows = scriptResponseJson.snapshot?.log?.split("\n")
ArrayList<String> errorRows = scriptResponseJson.errorMessages

Expand Down

0 comments on commit 0c58fba

Please sign in to comment.