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

chore: make error of non-existed source OCI layout more readable #1176

Merged
merged 7 commits into from
Nov 10, 2023

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Nov 6, 2023

What this PR does / why we need it:
This PR improves error message for OCI layout.

  • If the provided path doesn't exist

    • Before:
    oras cp --from-oci-layout foo:bar localhost:5000/test:copied
    Error: stat foo: no such file or directory
    • After:
    oras cp --from-oci-layout foo:bar localhost:5000/test:copied
    Error: invalid path in "foo:bar": stat foo: no such file or directory
  • If the provided path is a file but not a tarfile

    • Before:
    oras cp --from-oci-layout foo:bar localhost:5000/test:copied
    Error: unexpected EOF
    • After:
    oras cp --from-oci-layout foo:bar localhost:5000/test:copied
    Error: file "foo" is not a valid tarball: unexpected EOF

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1156

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2023

Codecov Report

Merging #1176 (aafb5c0) into main (ceb3b00) will decrease coverage by 0.18%.
The diff coverage is 0.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main    #1176      +/-   ##
==========================================
- Coverage   80.05%   79.87%   -0.18%     
==========================================
  Files          65       65              
  Lines        3564     3572       +8     
==========================================
  Hits         2853     2853              
- Misses        495      503       +8     
  Partials      216      216              
Files Coverage Δ
cmd/oras/internal/option/target.go 78.30% <0.00%> (-6.40%) ⬇️

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
cmd/oras/internal/option/target.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/target.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/target.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/target.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/target.go Outdated Show resolved Hide resolved
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Member

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sajayantony sajayantony merged commit 787d573 into oras-project:main Nov 10, 2023
5 checks passed
FeynmanZhou pushed a commit to FeynmanZhou/oras that referenced this pull request May 11, 2024
…s-project#1176)

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Co-authored-by: Sajay Antony <sajaya@microsoft.com>
Signed-off-by: Feynman Zhou <feynmanzhou@microsoft.com>
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.

add reference details to output errors
5 participants