From 4b352fc7f399a479d82181158d4d61e63790b31f Mon Sep 17 00:00:00 2001 From: Kate Sills Date: Thu, 14 May 2020 14:07:30 -0700 Subject: [PATCH] fix: fix typedef for makeInstance (was erroring incorrectly) and give better error message for an invalid installationHandle (#1109) --- packages/zoe/src/zoe.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/zoe/src/zoe.js b/packages/zoe/src/zoe.js index 2ee7d8b239b..78ad6b28ee6 100644 --- a/packages/zoe/src/zoe.js +++ b/packages/zoe/src/zoe.js @@ -74,8 +74,8 @@ import { makeTables } from './state'; * * @property {(installationHandle: InstallationHandle, * issuerKeywordRecord: IssuerKeywordRecord, - * terms: object?) - * => Invite} makeInstance + * terms?: object) + * => Promise} makeInstance * Zoe is long-lived. We can use Zoe to create smart contract * instances by specifying a particular contract installation to * use, as well as the `issuerKeywordRecord` and `terms` of the contract. The @@ -669,6 +669,10 @@ const makeZoe = (additionalEndowments = {}) => { issuerKeywordRecord = harden({}), terms = harden({}), ) => { + assert( + installationTable.has(installationHandle), + details`${installationHandle} was not a valid installationHandle`, + ); const { installation } = installationTable.get(installationHandle); const instanceHandle = harden({}); const contractFacet = makeContractFacet(instanceHandle);