Add filepath check for invoke (#222)

Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
This commit is contained in:
Dereck 2020-07-02 13:36:47 -04:00 committed by GitHub
parent 8b54e14ee4
commit fd98ec650a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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.