certificates icon indicating copy to clipboard operation
certificates copied to clipboard

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

Open marten-seemann opened this issue 1 year ago • 0 comments

Fixes https://github.com/smallstep/cli/issues/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 avatar Jun 20 '24 04:06 marten-seemann