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

fix: more informative error #1778

Merged
merged 1 commit into from
Apr 21, 2022
Merged

fix: more informative error #1778

merged 1 commit into from
Apr 21, 2022

Conversation

ybelMekk
Copy link
Contributor

@ybelMekk ybelMekk commented Apr 21, 2022

Command used: cosign attach attestation --attestation filename.json image
When running the attach attestation command with empty file payload the cli returns a hard to understand output:

Using payload from: filename.json
Error: unexpected end of JSON input
main.go:46: error during command execution: unexpected end of JSON input

By some investigation I found out that attestation file was empty, yes this is a user-error, so I recon it could be more informative as it throws the error while parsing the input making the real error a bit shaded.

Summary

Gives the user a more informative error when providing empty command input.

Ticket Link

Fixes

Release Note


When running the attach attestation command with empty file input the cli returns hard to understand output like:

```
file name too long
Using payload from: filename.json
Error: unexpected end of JSON input
main.go:46: error during command execution: unexpected end of JSON input
```

By some investigation I found out that attestation file was empty, yes this is a user-error, so I recon it could be more informative as it throws the error while parsing the input making the real error a bit shaded.

Signed-off-by: ybelMekk <youssef.bel.mekki@nav.no>
@dlorenc dlorenc merged commit 68bbaad into sigstore:main Apr 21, 2022
@github-actions github-actions bot added this to the v1.8.0 milestone Apr 21, 2022
mlieberman85 pushed a commit to mlieberman85/cosign that referenced this pull request May 6, 2022
When running the attach attestation command with empty file input the cli returns hard to understand output like:

```
file name too long
Using payload from: filename.json
Error: unexpected end of JSON input
main.go:46: error during command execution: unexpected end of JSON input
```

By some investigation I found out that attestation file was empty, yes this is a user-error, so I recon it could be more informative as it throws the error while parsing the input making the real error a bit shaded.

Signed-off-by: ybelMekk <youssef.bel.mekki@nav.no>
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.

2 participants