Skip to content

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

Merged
sajayantony merged 7 commits into
oras-project:mainfrom
qweeah:improve-error
Nov 10, 2023
Merged

sajayantony merged 7 commits into
oras-project:mainfrom
qweeah:improve-error

Conversation

@qweeah

@qweeah qweeah commented Nov 6, 2023 •

Copy link
Copy Markdown
Contributor

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

codecov-commenter commented Nov 6, 2023 •

Copy link
Copy Markdown

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%) ⬇️

Comment thread cmd/oras/internal/option/target.go Resolved
Comment thread cmd/oras/internal/option/target.go Resolved
Comment thread cmd/oras/internal/option/target.go Resolved
Comment thread cmd/oras/internal/option/target.go Resolved
Comment thread cmd/oras/internal/option/target.go Resolved
Comment thread cmd/oras/internal/option/target.go Resolved

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

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
FeynmanZhou pushed a commit to FeynmanZhou/oras that referenced this pull request May 11, 2024
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