Add filepath check for invoke

Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
This commit is contained in:
Chongxin Luo 2020-07-02 13:13:39 -04:00
parent 8b54e14ee4
commit a9c6bce08f

View file

@ -14,6 +14,10 @@ async function main() {
try {
// load the network configuration
const ccpPath = path.resolve(__dirname, '..', '..', 'test-network', 'organizations', 'peerOrganizations', 'org1.example.com', 'connection-org1.json');
const fileExists = fs.existsSync(ccpPath);
if (!fileExists) {
throw new Error(`no such file or directory: ${ccpPath}`);
}
let ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8'));
// Create a new file system based wallet for managing identities.