Skip to content

Commit

Permalink
Merge pull request #6881 from dibarbet/propogate_connection_errors
Browse files Browse the repository at this point in the history
Ensure failures to connect to the named pipe are propogated
  • Loading branch information
dibarbet authored Feb 13, 2024
2 parents abddd41 + 0b6a1bc commit f25cfb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lsptoolshost/roslynLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,12 +629,15 @@ export class RoslynLanguageServer {
throw new Error('Timeout. Named pipe information not received from server.');
}

const socketPromise = new Promise<net.Socket>((resolve) => {
const socketPromise = new Promise<net.Socket>((resolve, reject) => {
_channel.appendLine('attempting to connect client to server...');
const socket = net.createConnection(pipeConnectionInfo.pipeName, () => {
_channel.appendLine('client has connected to server');
resolve(socket);
});

// If we failed to connect for any reason, ensure the error is propagated.
socket.on('error', (err) => reject(err));
});

// Wait for the client to connect to the named pipe.
Expand Down

0 comments on commit f25cfb6

Please sign in to comment.