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

Proposal: Add String function to src.Sources #143

Open
gdavison opened this issue Jun 23, 2023 · 2 comments
Open

Proposal: Add String function to src.Sources #143

gdavison opened this issue Jun 23, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@gdavison
Copy link

It would be useful to have a String function that describes src.Sources. One use is in cases such as hashicorp/terraform-plugin-testing#133, where they are logged or displayed to users

@radeksimko
Copy link
Member

radeksimko commented Jul 4, 2023

I'm not opposed to the idea of adding String functions, but from what I can tell by reading the original linked issue, the real problem is usefulness of error types/messages, is it not?

So maybe we should ensure that errors returned from Ensure, Install and Remove, i.e. all essential methods on the Installer are wrapped in a custom error type, which also exposes what source produced that error?

The friction point I see with implementing String() is that it will be difficult to come up with an implementation that satisfies completeness and/or readability in all contexts.

cc @austinvalle

@austinvalle
Copy link
Member

I'm not opposed to the idea of adding String functions, but from what I can tell by reading the original linked issue, the real problem is usefulness of error types/messages, is it not?

Yes, that was the root problem we were looking at. I think exposing the source via a custom error, as you mentioned, would be good, however, if the errors are detailed enough that information may not be needed.

I didn't run into any particular errors from a source that were confusing so I'd be hesitant to suggest a change to hc-install without more detail.

@radeksimko radeksimko added the enhancement New feature or request label Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants