diff --git a/ts/reviewer/index.ts b/ts/reviewer/index.ts index 0fa0a626a..f95c97507 100644 --- a/ts/reviewer/index.ts +++ b/ts/reviewer/index.ts @@ -27,14 +27,21 @@ export function getTypedAnswer(): string | null { return typeans?.value ?? null; } -function _runHook(arr: Array): Promise { +function _runHook( + hooks: Array +): Promise>[]> { const promises: (Promise | void)[] = []; - for (let i = 0; i < arr.length; i++) { - promises.push(arr[i]()); + for (const hook of hooks) { + try { + const result = hook(); + promises.push(result); + } catch (error) { + console.log("Hook failed: ", error); + } } - return Promise.all(promises); + return Promise.allSettled(promises); } let _updatingQueue: Promise = Promise.resolve(); diff --git a/ts/tsconfig.json b/ts/tsconfig.json index 39ff8565a..91321c08f 100644 --- a/ts/tsconfig.json +++ b/ts/tsconfig.json @@ -3,7 +3,14 @@ "compilerOptions": { "target": "es6", "module": "es6", - "lib": ["es2017", "es2019.array", "es2018.promise", "dom", "dom.iterable"], + "lib": [ + "es2017", + "es2019.array", + "es2018.promise", + "es2020.promise", + "dom", + "dom.iterable" + ], "baseUrl": ".", "paths": { "lib/*": ["../bazel-bin/ts/lib/*"],