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

Better error messages #334

Open
HeshamMeneisi opened this issue Nov 4, 2021 · 0 comments
Open

Better error messages #334

HeshamMeneisi opened this issue Nov 4, 2021 · 0 comments

Comments

@HeshamMeneisi
Copy link

Is your feature request related to a problem? Please describe.

It's a go convention not to start a variable name in a package with the package name, which means that config should export config.Provider not config.ConfigProvider. However, wire doesn't include the package name in error messages which forces us to name providers package.PackageProvider for error visibility.

When combined with other generation tools (e.g. proto3), sometimes interfaces are renamed or moved during code generation. The wire error message just refers to the missing interface as invalid type, which is not very useful for debugging.

Describe the solution you'd like

  • Error messages referring to a provider should contain the full variable path including the package name (e.g. config.Provider instead of just Provider)

  • Error messages referring to an invalid type should include the raw text name of that type.
    Example:

init(s ServiceA){
...
}

Current error:

inject init: no provider found for invalid type

Improved error:

inject init: no provider found for invalid type (ServiceA)

Describe alternatives you've considered

For the first problem, the alternative is to include package names in the provider var name as per the example. For the second problem, there are no alternatives to wire printing the interface name.

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

No branches or pull requests

1 participant