Skip to content

Add TypeMismatch instead NotFound invoke error #80

Closed
@d-enk

Description

package main

import (
	"fmt"

	"github.com/samber/do/v2" // v2.0.0-beta.6
)

func main() {
	i := do.New()

	do.ProvideNamedValue(i, "NAME", 1)
	fmt.Println(do.InvokeNamed[any](i, "NAME"))
	// DI: could not find service `NAME`, available services: `NAME`
}

do/invoke.go

Lines 84 to 87 in 6a1325b

service, ok := serviceAny.(Service[T])
if !ok {
return empty[T](), serviceNotFound(injector, ErrServiceNotFound, invokerChain)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions