Skip to content

Commit

Permalink
Merge pull request #763 from gemini-testing/HERMIONE-818.unhandled_re…
Browse files Browse the repository at this point in the history
…jections

fix: handle rare cases with unhandled rejections due to circular refs
  • Loading branch information
DudaGod authored May 2, 2023
2 parents 4fd984b + fb873ad commit a4e99d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"mocha": "^10.2.0",
"plugins-loader": "^1.1.0",
"png-validator": "1.1.0",
"serialize-error": "^8.1.0",
"sharp": "~0.30.7",
"sizzle": "^2.3.6",
"temp": "^0.8.3",
Expand Down
16 changes: 13 additions & 3 deletions src/utils/processor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const { serializeError, deserializeError } = require("serialize-error");
const _ = require("lodash");
const { WORKER_UNHANDLED_REJECTION } = require("../constants/process-messages");
const ipc = require("./ipc");

Expand All @@ -25,7 +25,17 @@ function sendError(err, cb) {
try {
cb(err);
} catch {
const errWithoutCircularRefs = deserializeError(serializeError(err));
cb(errWithoutCircularRefs);
const shortenedErr = _.pick(err, [
"message",
"stack",
"code",
"screenshot",
// TODO: use fields from worker test-runner after rewrite on TS
"hermioneCtx",
"meta",
"history",
]);

cb(shortenedErr);
}
}

0 comments on commit a4e99d3

Please sign in to comment.