Skip to content

Improve error reporting/debugging of provide/inject, or allow require flag for inject #5628

@johnhargrove

Description

@johnhargrove

What problem does this feature solve?

Currently when an inject fails to resolve, nothing happens, and the injected value just remains untouched. This seems like an opportunity to warn the developer that an inject could not be resolved.

Perhaps this is intended behavior. Maybe it makes sense that sometimes an injection would not be resolved. If that is the case, could there be a way to indicate a given inject is required? A stricter injection method?

My current workaround is to throw an error if the object is undefined as of create (since injects are resolved by then), but it's a manual step that must be made in many places.

What does the proposed API look like?

If a new API is needed to support this, I am not sure how to design it.

As for warning, I was hoping that when an inject could not be resolved, there would be a warning in the browser console.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions