Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger error when dependencies cannot be resolved #20

Open
mauron85 opened this issue Oct 24, 2016 · 0 comments
Open

Trigger error when dependencies cannot be resolved #20

mauron85 opened this issue Oct 24, 2016 · 0 comments

Comments

@mauron85
Copy link

mauron85 commented Oct 24, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant