Closed
Description
What: propagated back to the caller an error returned by the invoked function doSomething
func doSomething() error {
...
return errDo
}
...
if _, err := container.Invoke(doSomething); err != nil {
if errors.Is(err , errDo) {
// handle doSomething error
}
// handle container errors
}
Invoked function result []any
may be empty in this way.
Why:
- It's not very convenient to inspect and assert invoked function result
[]any
just to check an error. - The current documentation is not clear, and I expected a such behavior before looked to the source. So I guess that other developers may have the same opinion.
- It's similar to other dependency injection packages like Uber's dig.
Metadata
Metadata
Assignees
Labels
No labels