Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error text when vat code is malformed #1609

Closed
FUDCo opened this issue Aug 24, 2020 · 1 comment · Fixed by #1687
Closed

Confusing error text when vat code is malformed #1609

FUDCo opened this issue Aug 24, 2020 · 1 comment · Fixed by #1687
Assignees
Labels
bug Something isn't working SwingSet package: SwingSet

Comments

@FUDCo
Copy link
Contributor

FUDCo commented Aug 24, 2020

Describe the bug
If the source file defining a vat fails to export a buildRootObject function, the error message the kernel prints is vat source bundle lacks (default) setup() function, which is confusing

To Reproduce
PIck a vat. Rename buildRootObject to buildRootOrbject. Run.

Expected behavior
I'd expect an error message more like vat source bundle lacks a buildRootObject() function

@FUDCo FUDCo added bug Something isn't working SwingSet package: SwingSet labels Aug 24, 2020
@warner
Copy link
Member

warner commented Aug 25, 2020

good point. That error is being generated at

assert(setup, `vat source bundle lacks (default) setup() function`);
, and that code is factored to handle both export function buildRootObject() -style vats and the older export default function setup() style. The presence of a named buildRootObject export should override any default. We have a managerOption flag to enable the use of setup, which is disabled for everything except the comms vat. The particular sequence there is:

  • look for buildRootObject, use it if present
  • else grab default
    • complain if it's not a function
    • complain if the use of setup is not enabled in the vat options
    • else use it

Maybe that should be refactored to be more like:

  • look for buildRootObject, use it if present
  • if setup is disabled, complain about the lack of `buildRootObject
  • else:
    • grab default
    • complain if it's not a function
    • else use it

@FUDCo FUDCo assigned FUDCo and unassigned warner Sep 3, 2020
FUDCo added a commit that referenced this issue Sep 3, 2020
Fix bug #1609, confusing error message on malformed vat code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SwingSet package: SwingSet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants