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

Wrong error handling and wrong exitCode #157

Closed
zvictor opened this issue Mar 8, 2022 · 1 comment
Closed

Wrong error handling and wrong exitCode #157

zvictor opened this issue Mar 8, 2022 · 1 comment

Comments

@zvictor
Copy link
Contributor

zvictor commented Mar 8, 2022

Description

The way errors are handled by this tool make it near impossible to build other tools or scripts on top of it in a reliable manner.
As soon as an error is thrown, the script calling fauna is broken.

Here is an example of intended behaviour, but that fails as soon as an error is thrown.

Steps to reproduce the error:

1- Copy the code below into /tmp/role.fql:

CreateRole({ name: "user",
  membership: [{ resource: Collection('User') }],
  privileges: [
    {
      resource: Function('logout'),
      actions: { call: true }
    }
  ]
})

2- Run the code below (or any code that would trigger a remote error within fauna):

npx fauna eval --format=json --file=/tmp/role.fql && echo '\nSuccess! No error code!'

Output:

{
  errors: [
    ...
    ...
  ]
}

Success! No error code!

Desired behaviour

  1. The exitCode should clearly never be 0 when the output is an error (which would then not let Success! No error code! be shown).
  2. The error message should go in the stderr but instead goes in stdout.
  3. The message has a JSON-like structure, but can't be parsed by any script because is not valid JSON.
@echo-bravo-yahoo
Copy link
Collaborator

Looks like this was largely resolved in #158 - going to close. Reopen if there's outstanding work.

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

No branches or pull requests

2 participants