Skip to content

Commit

Permalink
Merge pull request #1687 from Agoric/1609-confusing-error-message
Browse files Browse the repository at this point in the history
Fix bug #1609, confusing error message on malformed vat code
  • Loading branch information
FUDCo authored Sep 3, 2020
2 parents f35026a + 1e87530 commit 918f56b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/SwingSet/src/kernel/vatManager/localVatManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,17 @@ export function makeLocalVatManagerFactory(tools) {
vatPowers,
vatParameters,
);
} else {
} else if (enableSetup) {
const setup = vatNS.default;
assert(setup, `vat source bundle lacks (default) setup() function`);
assert(setup instanceof Function, `setup is not a function`);
assert(enableSetup, `got setup(), but not options.enableSetup`);
assert(
setup instanceof Function,
`vat source bundle default export is not a function`,
);
const helpers = harden({}); // DEPRECATED, todo remove from setup()
dispatch = setup(syscall, state, helpers, vatPowers);
} else {
throw Error(`vat source bundle lacks buildRootObject() function`);
}

const manager = finish(dispatch, meterRecord);
Expand Down

0 comments on commit 918f56b

Please sign in to comment.