From cfaccb307b16f10a623ef3a59469589014e14fc8 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 15 Dec 2017 16:18:19 -0500 Subject: [PATCH] throw error when target lib is not found --- lib/contracts/deploy.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 9d98b6a0..dfb6bf24 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -116,6 +116,10 @@ class Deploy { } let linkReference = '__' + filename + ":" + contractObj.className; 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); }