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#317

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Dec 1, 2020
1 parent 9768d93 commit 51af78d
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 51af78d

Please sign in to comment.