-
Notifications
You must be signed in to change notification settings - Fork 247
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
[Enhancement] Improve error messages for API configuration save #2973
Comments
This can be reproduced by adding this to the test suite:
|
The end goal is to return more meaningful error data in the HTTP API rather than just strings: [ { "value":"memory", "default":"9216", "request":"6144", "reason":"invalid", "requires":">= 9216" }, { "value":"disk-size", "default":"31", "request":"19", "reason":"invalid", "requires":">= 31" } ] instead of body: "Value '6144' for configuration property 'memory' is invalid, reason: requires memory in MiB >= 9216\n" + "Value '19' for configuration property 'disk-size' is invalid, reason: requires disk size in GiB >= 31\n" See issue crc-org#2973
I'd suggest improving the error types internally in crc so that we can serialize them to json in a more meaningful way. Rather than returning strings from validation functions, we could return more complex error types, which could be serialized to json in a more useful way. |
It might also help to describe the defaults in a better way from |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@anjannath has this been resolved? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@gbraad I think we could extend this issue to all API errors For example now: Just ignore any body text/json in error response. So caller of So hawing some sort of unified way to send/handle errors from daemon API is a good enhancement |
When a value fails validation, the error message is returned in the body. When multiple errors occur, they are concatenated in the body. This makes parsing very difficult in the applications using this:
Getting:
500
Is not the same as:
500
The text was updated successfully, but these errors were encountered: