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

Uncaught exception on non-existing files #215

Closed
shonfeder opened this issue Sep 23, 2022 · 0 comments · Fixed by #353
Closed

Uncaught exception on non-existing files #215

shonfeder opened this issue Sep 23, 2022 · 0 comments · Fixed by #353
Assignees

Comments

@shonfeder
Copy link
Contributor

'tntc parser foo.asdf` yields

Error: ENOENT: no such file or directory, open 'foo.adsf'
    at Object.openSync (node:fs:585:3)
    at readFileSync (node:fs:453:35)
    at parseModule (/home/sf/Sync/informal-systems/apalache/tnt/tntc/dist/src/cli.js:86:40)
    at Object.parse [as handler] (/home/sf/Sync/informal-systems/apalache/tnt/tntc/dist/src/cli.js:37:5)
    at /home/sf/Sync/informal-systems/apalache/tnt/tntc/node_modules/yargs/build/index.cjs:1:9052
    at j (/home/sf/Sync/informal-systems/apalache/tnt/tntc/node_modules/yargs/build/index.cjs:1:4931)
    at M.applyMiddlewareAndGetResult (/home/sf/Sync/informal-systems/apalache/tnt/tntc/node_modules/yargs/build/index.cjs:1:9021)
    at M.runCommand (/home/sf/Sync/informal-systems/apalache/tnt/tntc/node_modules/yargs/build/index.cjs:1:7206)
    at Jt.[runYargsParserAndExecuteCommands] (/home/sf/Sync/informal-systems/apalache/tnt/tntc/node_modules/yargs/build/index.cjs:1:55967)
    at Jt.parse (/home/sf/Sync/informal-systems/apalache/tnt/tntc/node_modules/yargs/build/index.cjs:1:38220) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'foo.adsf'
}

I should be able to fix this :)

@shonfeder shonfeder self-assigned this Sep 23, 2022
shonfeder pushed a commit that referenced this issue Nov 21, 2022
Closes #215

This is introduced in a way to suggest turning to sweet-monads/either
for sequencing our error-prone computations.

The sequencing and composition of our top-level routines exposed by CLI
is currently done via imperative early exits. This makes it hard to
reason about the code in general, but also breaks our ability to compose
these routines. Looking towards #345, we'll need typecheck to receive
the output of parse, then add it's typing information, before finally
printing to the `--out` location. This requires composing the routines
while handling possible error states, and just bailing with exit codes
won't work for that. Since we are already using `Either`, and since it
is designed for facilitating the composition of error-prone code, I
think we can massage these routines into shape with a few well-placed
Either's. ;)
shonfeder pushed a commit that referenced this issue Nov 21, 2022
shonfeder pushed a commit that referenced this issue Nov 22, 2022
Closes #215

This is introduced in a way to suggest turning to sweet-monads/either
for sequencing our error-prone computations.

The sequencing and composition of our top-level routines exposed by CLI
is currently done via imperative early exits. This makes it hard to
reason about the code in general, but also breaks our ability to compose
these routines. Looking towards #345, we'll need typecheck to receive
the output of parse, then add it's typing information, before finally
printing to the `--out` location. This requires composing the routines
while handling possible error states, and just bailing with exit codes
won't work for that. Since we are already using `Either`, and since it
is designed for facilitating the composition of error-prone code, I
think we can massage these routines into shape with a few well-placed
Either's. ;)
shonfeder pushed a commit that referenced this issue Nov 22, 2022
shonfeder pushed a commit that referenced this issue Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant