Skip to content

Commit

Permalink
Pass result to runSequential function
Browse files Browse the repository at this point in the history
  • Loading branch information
cham11ng committed Mar 24, 2021
1 parent fb0c762 commit 9f52d7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/service/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export async function executeOperation<T extends OperationContext>(

result.success = true;
} catch (e) {
logDb(`Error caught for connection ${connectionId}:`, e);
logDb(`Error caught for connection ${connectionId}:`);

result.error = e;
}

Expand All @@ -77,7 +78,7 @@ export async function executeOperation<T extends OperationContext>(
if (result.error) {
logDb('Result:\n%O', result);

throw result.error;
throw { result };
}

return result;
Expand Down
6 changes: 5 additions & 1 deletion src/util/promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export async function runSequentially<T>(promisers: Promiser<T>[]): Promise<T[]>

result.push(value);
} catch (err) {
throw err;
if (!err.result) {
throw err
}

result.push(err.result)
}
}

Expand Down

0 comments on commit 9f52d7b

Please sign in to comment.