Merge pull request #1302 from hgiesel/hookhandle
Catch reviewer hook errors in two ways
This commit is contained in:
commit
b61e90e995
@ -27,14 +27,21 @@ export function getTypedAnswer(): string | null {
|
||||
return typeans?.value ?? null;
|
||||
}
|
||||
|
||||
function _runHook(arr: Array<Callback>): Promise<void[]> {
|
||||
function _runHook(
|
||||
hooks: Array<Callback>
|
||||
): Promise<PromiseSettledResult<void | Promise<void>>[]> {
|
||||
const promises: (Promise<void> | 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<void> = Promise.resolve();
|
||||
|
@ -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/*"],
|
||||
|
Loading…
Reference in New Issue
Block a user