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

fix(rust): when an item is not found an error is returned #8548

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

davide-baldo
Copy link
Member

@davide-baldo davide-baldo commented Oct 18, 2024

When a show command is executed on any resource and that resource is missing, it'll simply print There are no <type> to show, return a SUCCESS (0) exit code.

$ ockam node show hello
  > There are no nodes to show
$ echo $?
0

This could be misleading, and an error should be printed.
Also, some tests rely on the fact that the shown command returning 0 means the resource exists.

With this patch the resource not found triggers an error instead.

$ target/debug/ockam node show hello


    Error:
    ────────────────────────────────────────────────────────────────────────────────

    There is no node with name hello (origin: Api, kind: NotFound, source location: implementations/rust/ockam/ockam_api/src/cli_state/nodes.rs:311:17)
    Please report this issue, with a copy of your logs, to https://github.com/build-trust/ockam/issues
    
    Error code: OCK500
    version: 0.134.0
    compiled from: d071009f2ce6f9f7c7be1d04e89308abc8c4420a

    If you need help, please email us on [email protected]
    We will promptly help you get unstuck and quickly resolve any problems.

    ────────────────────────────────────────────────────────────────────────────────
$ echo $?
70

While it's nice to return a non-successful exit code, this error message could be too much.

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 this pull request may close these issues.

1 participant