throw error when target lib is not found

This commit is contained in:
Iuri Matias 2017-12-15 16:18:19 -05:00
parent 7c33720c98
commit cfaccb307b
1 changed files with 4 additions and 0 deletions

View File

@ -116,6 +116,10 @@ class Deploy {
} }
let linkReference = '__' + filename + ":" + contractObj.className; let linkReference = '__' + filename + ":" + contractObj.className;
let toReplace = linkReference + "_".repeat(40 - linkReference.length); let toReplace = linkReference + "_".repeat(40 - linkReference.length);
if (contractCode.indexOf(linkReference) >= 0 && deployedAddress === undefined) {
let libraryName = contractObj.className;
return callback(new Error(contract.className + " needs " + libraryName + " but an address was not found, did you deploy it or configured an address?"));
}
contractCode = contractCode.replace(new RegExp(toReplace, "g"), deployedAddress); contractCode = contractCode.replace(new RegExp(toReplace, "g"), deployedAddress);
} }