Skip to content

Error handling and exit codes #554

@meringu

Description

@meringu

Describe the bug

The ldcli command isn't returning the expected error code (non zero) when a command fails.

To reproduce

Firstly, run up a new ldcli docker container:

docker run --rm -it --entrypoint sh launchdarkly/ldcli

Then, add an invalid header token to invoke an error:

/ # export LD_ACCESS_TOKEN=fake
/ # /ldcli flags list --project test
Invalid account ID header (code: unauthorized)
/ # echo $?
0

Expected behavior

The log is correct as there was an error, but it returned with exit code 0. I expect it to return with any code but 0.

Logs

See the steps to reproduce

CLI version

/ # /ldcli --version
ldcli version 1.14.0

OS/platform

MacOS, but I reproduced it in the docker container.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions