Skip to content

improve error message when attaching with invalid input #1214

Closed

Description

@qweeah

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

Activity

  1. added
    ux
    on Dec 26, 2023
  2. changed the title [-]improve error message when attaching with invalid annotation file[/-] [+]improve error message when attaching with invalid input[/+] on Dec 26, 2023
  3. added this to the v1.2.0 milestone on Dec 26, 2023
  4. wangxiaoxuan273 commented on Jan 19, 2024

    @wangxiaoxuan273
    Contributor

    I'd like to work on this.

  5. reopened this on Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ux

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions