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

api: output a more helpful error message when root is not found #1893

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

marten-seemann
Copy link
Contributor

Fixes smallstep/cli#841.

Surprisingly (to me), errs.NotFound does NOT return an errors that JSON-serializes the error message. Instead, it always serializes the default error message ("The requested resource could not be found. Please see the certificate authority logs for more info.").

I assume this is intended to hide internals of the error (although this isn't documented anywhere), so I didn't change this behavior. Instead, I'm using the slightly convoluted errs.NotFoundErr with an option to create an error that actually serializes the error message we want to display to the user. I also updated the test case to check for this message.

@marten-seemann marten-seemann requested a review from hslatman June 20, 2024 04:17
@github-actions github-actions bot added the needs triage Waiting for discussion / prioritization by team label Jun 20, 2024
@marten-seemann marten-seemann force-pushed the root-not-found-error-message branch from 0a8bcd7 to 38733da Compare June 20, 2024 05:33
api/api.go Outdated Show resolved Hide resolved
api/api_test.go Outdated Show resolved Hide resolved
api/api_test.go Outdated Show resolved Hide resolved
test/integration/requestid_test.go Outdated Show resolved Hide resolved
test/integration/requestid_test.go Outdated Show resolved Hide resolved
test/integration/requestid_test.go Outdated Show resolved Hide resolved
test/integration/requestid_test.go Outdated Show resolved Hide resolved
Co-authored-by: Herman Slatman <hslatman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Waiting for discussion / prioritization by team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unclear error when CA fingerprint does not match
2 participants