Skip to content

Trigger error when dependencies cannot be resolved #20

Description

@mauron85

Hi thanks for this wonderful library. I was using older version for quite long time. Recently updated to latest (still 2 years old ;-).

Anyway my problem is that I would like to detect when injectable declares non existing dependency. Now it seems container just dies.

How to reproduce:

var container = require( 'simple-ioc' )
    .getContainer()
    .registerIocLog('log')
    .registerInjectable( {
        transientModule: function( parentName ) {
            return function() {
                console.log( parentName );
            };
        },
        singletonModule1: function( transientModule, nonExisting ) {
            return transientModule;
        },
        singletonModule2: function( transientModule ) {
            return transientModule;
        }
    } )
    .inject( function( singletonModule1, singletonModule2 ) {
        singletonModule1(); // Will output "singletonModule1"
        singletonModule2(); // Will output "singletonModule2"
    } );

inject is never called because of nonExisting dependency. However without any warning message,it is hard to detect which module has wrong dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions