Skip to content

Commit

Permalink
add network exception
Browse files Browse the repository at this point in the history
  • Loading branch information
vita-dounai committed Sep 20, 2019
1 parent 385ec32 commit dbbbff6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/caliper-fisco-bcos/lib/channelPromise.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ const fs = require('fs');
const net = require('net');
const uuidv4 = require('uuid/v4');
const events = require('events');
const { NetworkError } = require('./exceptions').NetworkError;

class NetworkError extends Error {
constructor(msg) {
super(msg);
this.name = 'NetworkError';
}
}

let emitters = new Map();
let buffers = new Map();
Expand Down Expand Up @@ -86,9 +92,9 @@ function createNewSocket(ip, port, authentication) {
tlsSocket.on('error', function (error) {
throw new Error(error);
});

let socketID = `${ip}:${port}`;

lastBytesRead.set(socketID, 0);

tlsSocket.on('data', function (data) {
Expand Down

0 comments on commit dbbbff6

Please sign in to comment.