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

Feature request: nothrow() only for a subset of error codes #714

Open
neongreen opened this issue Jan 12, 2024 · 0 comments · May be fixed by #758
Open

Feature request: nothrow() only for a subset of error codes #714

neongreen opened this issue Jan 12, 2024 · 0 comments · May be fixed by #758
Labels
feature New feature or request

Comments

@neongreen
Copy link

There are commands, eg. openssl s_client -checkend, which return:

  • exit code 0 for True ("certificate is valid")
  • exit code 1 for False ("certificate is invalid")
  • exit code >1 for actual errors.

I'd like to be able to say smth like $`openssl s_client ...`.nothrow(out => out.exitCode <= 1) so that it still fails on genuine errors but lets me have true/false otherwise.

Right now I'm doing it like:

      await $`echo ${cert} | openssl x509 -noout -checkend ${86400 * 30}`.catch(err => {
        if (err.exitCode === 1) return err
        else throw err
      })
@antonmedv antonmedv added the feature New feature or request label Jan 12, 2024
@google google deleted a comment from Authpointg Jan 26, 2024
@google google deleted a comment from Authpointg Jan 26, 2024
antongolub added a commit to antongolub/zx that referenced this issue Mar 31, 2024
@antongolub antongolub linked a pull request Mar 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants