Skip to content

Commit

Permalink
refactor(core): Patch Bull to include stack trace on job fail (#12547)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Jan 10, 2025
1 parent e96059c commit 176c068
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"ws": ">=8.17.1"
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"@types/[email protected]": "patches/@[email protected]",
Expand Down
21 changes: 21 additions & 0 deletions patches/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/lib/job.js b/lib/job.js
index 6a3606974fd3e397c6c5b2b6e65b20670c68f753..4cdbed1d564ceeb5a80c92eb605e49cfd3c8ccdd 100644
--- a/lib/job.js
+++ b/lib/job.js
@@ -511,9 +511,14 @@ Job.prototype.finished = async function() {
}
};

- const onFailed = (jobId, failedReason) => {
+ const onFailed = async (jobId, failedReason) => {
if (String(jobId) === String(this.id)) {
- reject(new Error(failedReason));
+ const job = await Job.fromId(this.queue, this.id);
+ const error = new Error(failedReason);
+ if (job && job.stacktrace && job.stacktrace.length > 0) {
+ error.stack = job.stacktrace.join('\n');
+ }
+ reject(error);
removeListeners();
}
};
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 176c068

Please sign in to comment.