uselagoon / uselagoon/lagoon-cli

Respect JSON output for errors

Open
#439 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
28
Forks
14
Avg merge
1d 2h
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with lagoon list deployments --project='does-not-exist' --environment='banana' --output-json, then trace the CLI's error-response handling. The work is done when errors produced with --output-json are valid JSON rather than plain strings, including the unauthorized example.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.