Skip to content

Commit

Permalink
fix(common): servers.startOnPort() error handling
Browse files Browse the repository at this point in the history
Promise no longer hangs if error event is fired on the server object

Fixes hyperledger-cacti#317

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Nov 6, 2020
1 parent 7e7cce8 commit 31f98f4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/cactus-common/src/main/typescript/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class Servers {
const server: Server = await new Promise((resolve, reject) => {
const aServer: Server = createServer();
aServer.once("listening", () => resolve(aServer));
aServer.once("error", (err: Error) => reject(err));
aServer.listen(port, "localhost");
});

Expand Down

0 comments on commit 31f98f4

Please sign in to comment.