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

Improve error message #21

Merged
merged 1 commit into from
Mar 20, 2024
Merged

Improve error message #21

merged 1 commit into from
Mar 20, 2024

Conversation

strokyl
Copy link
Collaborator

@strokyl strokyl commented Mar 20, 2024

No description provided.

Copy link

linear bot commented Mar 20, 2024

CONS-861 Errors messages in the CLI

Sometimes the error is a String (json decoding error I think), and when it’s a functional or 500, it’s JSON.
In both cases the CLI could benefit from presenting it more nicely with little effort.
We have -v  for details remember.
Some examples:
Replace the whole first error line with the HTTP error code that brings no value to the user

# Now
$ conduktor apply -f .
application/clickstream-app: NotChanged
Could not apply resource app-instance/clickstream-app-dev: Error applying resource app-instance/clickstream-app-dev, got status code: 400:
 Invalid value for: body (Missing required field at 'version')

with

# Prefer
$ conduktor apply -f .❇︎
application/clickstream-app: Success (NotChanged)
app-instance/clickstream-app-dev: Error: Invalid value for: body (Missing required field at 'version')

Another one:

# Now
$ conduktor apply -f .
application/clickstream-app: NotChanged
Could not apply resource app-instance/clickstream-app-dev: Error applying resource app-instance/clickstream-app-dev, got status code: 404:
 {"title":"Cluster with id shadow-it not found"}

Not sure why the json and title object.
As per the openAPI document there’s also a message and cause object. Do you intend to use these fields in the CLI ?
Simplify, straight to value:

# Prefer
$ conduktor apply -f .
application/clickstream-app: Success (NotChanged)
app-instance/clickstream-app-dev: Error: Cluster with id shadow-it not found

Another one:

# Now
$ conduktor apply -f .
application/clickstream-app: NotChanged
Could not apply resource app-instance/clickstream-app-dev: Error applying resource app-instance/clickstream-app-dev, got status code: 400:
 Invalid value for: body (Missing required field at 'spec.resources[0].name', 'PREFIXED' is not a member of enum io.conduktor.core.domain.selfserve.ResourcePatternType$4aee458a at 'spec.resources[0].patternType', Missing required field at 'spec.resources[1].name', 'PREFIXED' is not a member of enum io.conduktor.core.domain.selfserve.ResourcePatternType$4aee458a at 'spec.resources[1].patternType', Missing required field at 'version')

I’d rather have a cleaner message that doesn’t reference object pointers. Would be amazing to see the choices.
'PREFIXED' is not a member of enum io.conduktor.core.domain.selfserve.ResourcePatternType$4aee458a at 'spec.resources[0].patternType'

 Got 'PREFIXED' at 'spec.resources[0].patternType' expected [PREFIX, LITERAL]

# Prefer
$ conduktor apply -f .
application/clickstream-app: Success (NotChanged)
app-instance/clickstream-app-dev: Error: Invalid value for: body (
  Missing required field at 'spec.resources[0].name', 
  Expected [PREFIX, LITERAL] at 'spec.resources[0].patternType' but got 'PREFIXED',
  Missing required field at 'spec.resources[1].name', 
  Expected [PREFIX, LITERAL] at 'spec.resources[1].patternType' but got 'PREFIXED',
  Missing required field at 'version')

In essence, I would prefer we go straight to the problems that the user want to read.

@strokyl strokyl merged commit 23d0d38 into main Mar 20, 2024
3 checks passed
@qboileau qboileau deleted the cons-861-errors-messages-in-the-cli branch March 25, 2024 14:04
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.

2 participants