mookid8000 / Topos

:cyclone: .NET Event Processing library
MIT License
23 stars 5 forks source link

Fix error message when injectionist could not resolve a service #1

Closed mookid8000 closed 5 years ago

mookid8000 commented 5 years ago

If this line fails:

var producerImplementation = c.Get<IProducerImplementation>();

the error will simply say

Topos.Internals.ResolutionException : Could not find resolver for Topos.IProducerImplementation

Injectionist (at least in Topos) supports providing some extra error message details along with each resolve request, e.g. like so:

var producerImplementation = c.Get<IProducerImplementation>(
    errorMessage: "Please remember to configure which broker implementation to use"
);

but that can be quite misleading if the broker was in fact registered, but it could not be resolved because one of its dependencies could not be resolved.

This should be fixed, so that only the custom error message "this!" from the final context.Get<Whatever>(errorMessage: "this!") is shown.

mookid8000 commented 5 years ago

Turns out that that's how it works.... 😐