Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Injector error can be misleading during module instantiation #13481

Open
@robstove

Description

@robstove

During module loading there is an opportunity for failure in the runInvokeQueue() function. This can occur when the expected function on the provider does not exist. To provide additional details to the developer I propose checking for undefined value before executing the provider function. This will provide additional details about why the module failed to load.

src\auto\injector.js (starting at line 736)

  function runInvokeQueue(queue) {
    var i, ii;
    for (i = 0, ii = queue.length; i < ii; i++) {
      var invokeArgs = queue[i],
          provider = providerInjector.get(invokeArgs[0]);

      // Undefined provider method check.
      var providerFn = provider[invokeArgs[1]];
      if (providerFn === undefined) {
        throw new Error("Method " + invokeArgs[1] + " was not found for provider " + invokeArgs[0] + ".");
      }

      providerFn.apply(provider, invokeArgs[2]);
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions