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 when attaching with invalid input #1214

Closed
Tracked by #1218
qweeah opened this issue Dec 26, 2023 · 1 comment · Fixed by #1253
Closed
Tracked by #1218

improve error message when attaching with invalid input #1214

qweeah opened this issue Dec 26, 2023 · 1 comment · Fixed by #1253
Assignees
Labels
ux User experience related
Milestone

Comments

@qweeah
Copy link
Contributor

qweeah commented Dec 26, 2023

if no file or annotation is provided

$ oras attach --artifact-type sbom/example localhost:5000/sample/images:foobar
Error: no blob is provided

Suggested error message:

$ oras attach --artifact-type sbom/example localhost:5000/sample/images:foobar
Error: neither file nor annotation provided in the command
Usage: oras attach [flags] --artifact-type=<type> <name>{:<tag>|@<digest>} <file>[:<type>] [...]
To attach to an existing artifact, please provide files via argument or annotations via flag "--annotation". Run "oras attach -h" for more options and examples

If the provided annotation file is invalid

Current behavior and output:

$ oras push --annotation-file sbom.json ghcr.io/library/alpine:3.9
Error: failed to load annotations from sbom.json: json: cannot unmarshal string into Go value of type map[string]map[string]string. Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations

Suggested error message:

$ oras push --annotation-file annotation.json ghcr.io/library/alpine:3.9
Error: invalid annotation json file: failed to load annotations from annotation.json.
Annotation file doesn't match the required format. Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations
@qweeah qweeah added the ux User experience related label Dec 26, 2023
@qweeah qweeah changed the title improve error message when attaching with invalid annotation file improve error message when attaching with invalid input Dec 26, 2023
@qweeah qweeah mentioned this issue Dec 26, 2023
9 tasks
@qweeah qweeah added this to the v1.2.0 milestone Dec 26, 2023
@wangxiaoxuan273
Copy link
Contributor

I'd like to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux User experience related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants