Skip to content

Commit

Permalink
Enhance error message and stack trace for Python only bots
Browse files Browse the repository at this point in the history
  • Loading branch information
datakurre committed Sep 19, 2023
1 parent 672ff42 commit 7961160
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile.release
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARTIFACT_NAME = camunda-rcc-worker
ARTIFACT_VERSION ?= 0.8.2-2
ARTIFACT_VERSION ?= 0.8.2-3
ARTIFACT_FULLNAME ?= $(ARTIFACT_NAME)-$(ARTIFACT_VERSION).tar.gz
REPOSITORY ?= nomad-local

Expand All @@ -21,7 +21,7 @@ clean:

.PHONY: publish
publish: $(ARTIFACT_FULLNAME)
jf rt u $(ARTIFACT_FULLNAME) $(REPOSITORY)/$(ARTIFACT_NAME)/
jfrog-cli rt u $(ARTIFACT_FULLNAME) $(REPOSITORY)/$(ARTIFACT_NAME)/


###
Expand Down
25 changes: 17 additions & 8 deletions carrot_rcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,6 @@ const failReason = async (tasksDir: string): Promise<string> => {
for (const match of xml.matchAll(/status="FAIL"[^>]*.([^<]*)/g)) {
reason = match[1].trim() || reason;
}
} else if (path.basename(file) === "stdout.log") {
const xml = fs.readFileSync(file).toString("utf-8");
for (const match of xml.matchAll(/([a-zA-Z0-9\.]+:\s.*)/g)) {
reason = match[1].trim() || reason;
}
}
}
return reason;
Expand Down Expand Up @@ -856,6 +851,19 @@ const subscribe = (topic: string) => {
);
}
}
// Replace dummy error message with the last
if (errorMessage === "fail") {
for (const line of stdout.concat(stderr)) {
const match = line.match(/([a-zA-Z0-9\.]+:\s.*)/g);
if (
match &&
match.length &&
!match[match.length - 1].trim().startsWith("Error: exit status")
) {
errorMessage = match[match.length - 1].trim() || errorMessage;
}
}
}
return code === 0
? resolve(task)
: reject({
Expand All @@ -865,9 +873,10 @@ const subscribe = (topic: string) => {
stack:
errorMessage === "error"
? stdout.join("") + stderr.join("")
: stdout
.join("")
.replace(/[a-zA-Z0-9\-.]+==[a-zA-Z0-9\-.]+\n/g, ""),
: (stdout.join("") + stderr.join("")).replace(
/[a-zA-Z0-9\-.]+==[a-zA-Z0-9\-.]+\n/g,
""
),
});
});
});
Expand Down

0 comments on commit 7961160

Please sign in to comment.