Skip to content

SES_IMPORT_REJECTED lacks location of offending code #2430

Open
@dckc

Description

@dckc

Describe the bug

When I hit SES_IMPORT_REJECTED, I expect to see the file and line number of the syntax error, but all I get is a stack trace of endo code that did the rejecting.

It's like a compiler crash instead of a compiler reporting an error in the compiled code:

REJECTED from ava test("Start the contract"): (SyntaxError#2)
SyntaxError#2: Possible import expression rejected at <unknown>:7. (SES_IMPORT_REJECTED)
  at Object.execute (.../compartment-mapper/src/parse-pre-cjs.js:30:27)
  at require (.../compartment-mapper/src/parse-cjs-shared-export-wrapper.js:135:29)
  at eval (eval at <anonymous> (eval at makeEvaluate (file:///tmp/noble-hashes-app/node_modules/ses/src/make-evaluate.js:92:27)), <anonymous>:5:20)
  at Object.execute (.../compartment-mapper/src/parse-pre-cjs.js:40:1)
  at require (.../compartment-mapper/src/parse-cjs-shared-export-wrapper.js:135:29)
  at eval (eval at <anonymous> (eval at makeEvaluate (file:///tmp/noble-hashes-app/node_modules/ses/src/make-evaluate.js:92:27)), <anonymous>:4:18)
  at Object.execute (.../compartment-mapper/src/parse-pre-cjs.js:40:1)
  at eval (.../noble-hashes-app-contract/src/offer-up.contract.js:1:182)
  at async importBundle (.../import-bundle/src/index.js:57:18)

Steps to reproduce

See Agoric/agoric-sdk#9958 (reply in thread)

Expected behavior

file, line number where the SyntaxError occurred whenever SES_IMPORT_REJECTED is thrown.

Platform environment

yarn create @agoric/dapp clones https://github.com/Agoric/dapp-offer-up , currently at b61d102 , including resolutions such as

    "@endo/bundle-source": "2.5.2-upstream-rollup",

Additional context

cc @tgrecojs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions