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 2, 2020
1 parent 0b65ad2 commit 93ed572
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 93ed572

Please sign in to comment.