Skip to content

Respect JSON output for errors #439

@seanhamlin

Description

@seanhamlin

Is your feature request related to a problem? Please describe.

At present, if the CLI returns an error response, it is always in the form of a string, even if you have --output-json supplied

Describe the solution you'd like

When you request JSON output, output everything as JSON. Including errors.

Describe alternatives you've considered

String matching on the output, and if it looks like JSON attempt to decode it. Not ideal

Additional context

Example command showing the issue

$ lagoon list deployments --project='does-not-exist' --environment='banana' --output-json 
Error: Unauthorized: You don't have permission to "view" on "project": check if the project or environment exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions