Skip to content

Commit

Permalink
Fixed linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sarda-devesh committed Nov 14, 2022
1 parent 5141c68 commit 4dcce6a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/nerdbank-streams/src/MultiplexingStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ export class MultiplexingStreamClass extends MultiplexingStream {
payloadToSend = castedFormatter.serializeException(error);
}

// Create the header and send the frame to the remote side
// Create the header and send the frame to the remote side
const frameHeader = new FrameHeader(ControlCode.ChannelTerminated, channel.qualifiedId);
await this.sendFrameAsync(frameHeader, payloadToSend);
} catch (err) {
Expand Down Expand Up @@ -748,7 +748,7 @@ export class MultiplexingStreamClass extends MultiplexingStream {
if (channel) {
this.deleteOpenChannel(channelId);
this.removeChannelFromOfferedQueue(channel);

// Extract the exception that we received from the remote side
let remoteException : Error | null = null;
if(this.protocolMajorVersion > 1 && payload.length > 0) {
Expand All @@ -758,7 +758,7 @@ export class MultiplexingStreamClass extends MultiplexingStream {
// Extract the error using the casted formatter
remoteException = castedFormatter.deserializeException(payload);
}

// Dispose the channel
channel.dispose(remoteException);
}
Expand Down
6 changes: 3 additions & 3 deletions src/nerdbank-streams/src/MultiplexingStreamFormatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export class MultiplexingStreamV2Formatter extends MultiplexingStreamFormatter {
let errorMsg : string = error.message;
if (!errorMsg) {
errorMsg = `Error of type ${error.name} was thrown`;
}
}

// Return the buffer for this payload
const payload : any[] = [errorMsg];
Expand All @@ -312,13 +312,13 @@ export class MultiplexingStreamV2Formatter extends MultiplexingStreamFormatter {

deserializeException(payload: Buffer) : Error | null {
// If the payload is empty then return null
if(payload.length == 0) {
if(payload.length === 0) {
return null;
}

// Make sure that the message pack object contains a message
const msgpackObject = msgpack.decode(payload);
if (!msgpackObject || msgpackObject.length == 0) {
if (!msgpackObject || msgpackObject.length === 0) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ import { ChannelOptions } from "../ChannelOptions";
const communicationChannel = await mx.offerChannelAsync("clientErrorOfferComm");

channelToCompleteWithError.dispose(error);
channelToCompleteWithError.completion.then(response => {
channelToCompleteWithError.completion.then(_ => {
throw new Error("Channel disposed with error didn't complete with error");
}).catch(error => {
expect(error.message).toContain(errorMsg);
}).catch( (channelCompleteErr) => {
expect(channelCompleteErr.message).toContain(errorMsg);
});

let expectedErrMessage = `Received error from remote side: ${errorMsg}`;
Expand Down
8 changes: 4 additions & 4 deletions src/nerdbank-streams/src/tests/MultiplexingStream.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,19 @@ import { nextTick } from "process";
localChannel.completion.then(response => {
localChannelCompleted.reject();
throw new Error("Channel disposed with error didn't complete with error");
}).catch(error => {
}).catch(localChannelErr => {
localChannelCompleted.resolve();
expect(error.message).toContain(errorMsg);
expect(localChannelErr.message).toContain(errorMsg);
});

// Ensure that the remote channel only throws an error for protocol version > 1
remoteChannel.completion.then( response => {
remoteChannelCompleted.resolve();
expect(protocolMajorVersion).toEqual(1);
}).catch(error => {
}).catch(remoteChannelErr => {
remoteChannelCompleted.resolve();
expect(protocolMajorVersion).toBeGreaterThan(1);
expect(error.message).toContain(errorMsg);
expect(remoteChannelErr.message).toContain(errorMsg);
});

// Ensure that we don't call multiplexing dispose too soon
Expand Down

0 comments on commit 4dcce6a

Please sign in to comment.