Skip to content

Commit b667b95

Browse files
feat(workers): catch-unhandled-exceptions (#532) (#538)
* feat(workers): add decorator to catch unhandled exceptions and report them to Hawk with worker type context * fix lint * Revert "fix lint" This reverts commit 7a7c0a9. * Revert "feat(workers): add decorator to catch unhandled exceptions and report them to Hawk with worker type context" This reverts commit ebb1fd7. * refactor(runner): add active worker names to HawkCatcher context Co-authored-by: KoshaevEugeny <103786108+akulistus@users.noreply.github.com>
1 parent 360e31a commit b667b95

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

runner.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ import * as dotenv from 'dotenv';
1212

1313
dotenv.config();
1414

15-
if (process.env.HAWK_CATCHER_TOKEN) {
16-
HawkCatcher.init(process.env.HAWK_CATCHER_TOKEN);
17-
}
18-
1915
type WorkerConstructor = new () => Worker;
2016

2117
const BEGINNING_OF_ARGS = 2;
@@ -27,6 +23,18 @@ const BEGINNING_OF_ARGS = 2;
2723
*/
2824
const workerNames = process.argv.slice(BEGINNING_OF_ARGS);
2925

26+
/**
27+
* Initialize HawkCatcher
28+
*/
29+
if (process.env.HAWK_CATCHER_TOKEN) {
30+
HawkCatcher.init({
31+
token: process.env.HAWK_CATCHER_TOKEN,
32+
context: {
33+
workerTypes: workerNames.join(","),
34+
}
35+
});
36+
}
37+
3038
/**
3139
* Workers dispatcher.
3240
* Load, run and finish workers.

0 commit comments

Comments
 (0)