inversify 6.1.3 → 6.1.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/amd/constants/error_msgs.d.ts +1 -1
- package/amd/constants/error_msgs.js +3 -2
- package/amd/planning/planner.js +5 -2
- package/es/constants/error_msgs.d.ts +1 -1
- package/es/constants/error_msgs.js +1 -1
- package/es/planning/planner.js +5 -2
- package/es6/constants/error_msgs.d.ts +1 -1
- package/es6/constants/error_msgs.js +3 -2
- package/es6/planning/planner.js +5 -2
- package/lib/constants/error_msgs.d.ts +1 -1
- package/lib/constants/error_msgs.js +3 -2
- package/lib/planning/planner.js +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
12
|
|
|
13
13
|
### Fixed
|
|
14
14
|
|
|
15
|
+
## [6.1.4-beta.0]
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Updated planner with better error description when a binding can not be properly resolved.
|
|
19
|
+
|
|
15
20
|
## [6.1.3]
|
|
16
21
|
|
|
17
22
|
### Fixed
|
|
@@ -5,7 +5,7 @@ export declare const KEY_NOT_FOUND: string;
|
|
|
5
5
|
export declare const AMBIGUOUS_MATCH: string;
|
|
6
6
|
export declare const CANNOT_UNBIND: string;
|
|
7
7
|
export declare const NOT_REGISTERED: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const TRYING_TO_RESOLVE_BINDINGS: (name: string) => string;
|
|
9
9
|
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
10
10
|
export declare const CIRCULAR_DEPENDENCY: string;
|
|
11
11
|
export declare const INVALID_BINDING_TYPE: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
define(["require", "exports"], function (require, exports) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.
|
|
4
|
+
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.TRYING_TO_RESOLVE_BINDINGS = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
|
|
5
5
|
exports.DUPLICATED_INJECTABLE_DECORATOR = 'Cannot apply @injectable decorator multiple times.';
|
|
6
6
|
exports.DUPLICATED_METADATA = 'Metadata key was used more than once in a parameter:';
|
|
7
7
|
exports.NULL_ARGUMENT = 'NULL argument';
|
|
@@ -9,7 +9,8 @@ define(["require", "exports"], function (require, exports) {
|
|
|
9
9
|
exports.AMBIGUOUS_MATCH = 'Ambiguous match found for serviceIdentifier:';
|
|
10
10
|
exports.CANNOT_UNBIND = 'Could not unbind serviceIdentifier:';
|
|
11
11
|
exports.NOT_REGISTERED = 'No matching bindings found for serviceIdentifier:';
|
|
12
|
-
|
|
12
|
+
var TRYING_TO_RESOLVE_BINDINGS = function (name) { return "Trying to resolve bindings for \"".concat(name, "\""); };
|
|
13
|
+
exports.TRYING_TO_RESOLVE_BINDINGS = TRYING_TO_RESOLVE_BINDINGS;
|
|
13
14
|
var UNDEFINED_INJECT_ANNOTATION = function (name) {
|
|
14
15
|
return "@inject called with undefined this could mean that the class ".concat(name, " has ") +
|
|
15
16
|
'a circular dependency problem. You can use a LazyServiceIdentifer to ' +
|
package/amd/planning/planner.js
CHANGED
|
@@ -61,7 +61,7 @@ define(["require", "exports", "@inversifyjs/core", "../bindings/binding_count",
|
|
|
61
61
|
else {
|
|
62
62
|
activeBindings = bindings;
|
|
63
63
|
}
|
|
64
|
-
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
|
|
64
|
+
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, parentRequest, target, context.container);
|
|
65
65
|
return activeBindings;
|
|
66
66
|
}
|
|
67
67
|
function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
@@ -76,7 +76,7 @@ define(["require", "exports", "@inversifyjs/core", "../bindings/binding_count",
|
|
|
76
76
|
}
|
|
77
77
|
return metadataList;
|
|
78
78
|
}
|
|
79
|
-
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
79
|
+
function _validateActiveBindingCount(serviceIdentifier, bindings, parentRequest, target, container) {
|
|
80
80
|
switch (bindings.length) {
|
|
81
81
|
case binding_count_1.BindingCount.NoBindingsAvailable:
|
|
82
82
|
if (target.isOptional()) {
|
|
@@ -87,6 +87,9 @@ define(["require", "exports", "@inversifyjs/core", "../bindings/binding_count",
|
|
|
87
87
|
var msg = ERROR_MSGS.NOT_REGISTERED;
|
|
88
88
|
msg += (0, serialization_1.listMetadataForTarget)(serviceIdentifierString, target);
|
|
89
89
|
msg += (0, serialization_1.listRegisteredBindingsForServiceIdentifier)(container, serviceIdentifierString, getBindings);
|
|
90
|
+
if (parentRequest !== null) {
|
|
91
|
+
msg += "\n".concat(ERROR_MSGS.TRYING_TO_RESOLVE_BINDINGS((0, serialization_1.getServiceIdentifierAsString)(parentRequest.serviceIdentifier)));
|
|
92
|
+
}
|
|
90
93
|
throw new Error(msg);
|
|
91
94
|
}
|
|
92
95
|
case binding_count_1.BindingCount.OnlyOneBindingAvailable:
|
|
@@ -5,7 +5,7 @@ export declare const KEY_NOT_FOUND: string;
|
|
|
5
5
|
export declare const AMBIGUOUS_MATCH: string;
|
|
6
6
|
export declare const CANNOT_UNBIND: string;
|
|
7
7
|
export declare const NOT_REGISTERED: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const TRYING_TO_RESOLVE_BINDINGS: (name: string) => string;
|
|
9
9
|
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
10
10
|
export declare const CIRCULAR_DEPENDENCY: string;
|
|
11
11
|
export declare const INVALID_BINDING_TYPE: string;
|
|
@@ -5,7 +5,7 @@ export var KEY_NOT_FOUND = 'Key Not Found';
|
|
|
5
5
|
export var AMBIGUOUS_MATCH = 'Ambiguous match found for serviceIdentifier:';
|
|
6
6
|
export var CANNOT_UNBIND = 'Could not unbind serviceIdentifier:';
|
|
7
7
|
export var NOT_REGISTERED = 'No matching bindings found for serviceIdentifier:';
|
|
8
|
-
export var
|
|
8
|
+
export var TRYING_TO_RESOLVE_BINDINGS = function (name) { return "Trying to resolve bindings for \"".concat(name, "\""); };
|
|
9
9
|
export var UNDEFINED_INJECT_ANNOTATION = function (name) {
|
|
10
10
|
return "@inject called with undefined this could mean that the class ".concat(name, " has ") +
|
|
11
11
|
'a circular dependency problem. You can use a LazyServiceIdentifer to ' +
|
package/es/planning/planner.js
CHANGED
|
@@ -42,7 +42,7 @@ function _getActiveBindings(metadataReader, avoidConstraints, context, parentReq
|
|
|
42
42
|
else {
|
|
43
43
|
activeBindings = bindings;
|
|
44
44
|
}
|
|
45
|
-
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
|
|
45
|
+
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, parentRequest, target, context.container);
|
|
46
46
|
return activeBindings;
|
|
47
47
|
}
|
|
48
48
|
function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
@@ -57,7 +57,7 @@ function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
|
57
57
|
}
|
|
58
58
|
return metadataList;
|
|
59
59
|
}
|
|
60
|
-
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
60
|
+
function _validateActiveBindingCount(serviceIdentifier, bindings, parentRequest, target, container) {
|
|
61
61
|
switch (bindings.length) {
|
|
62
62
|
case BindingCount.NoBindingsAvailable:
|
|
63
63
|
if (target.isOptional()) {
|
|
@@ -68,6 +68,9 @@ function _validateActiveBindingCount(serviceIdentifier, bindings, target, contai
|
|
|
68
68
|
var msg = ERROR_MSGS.NOT_REGISTERED;
|
|
69
69
|
msg += listMetadataForTarget(serviceIdentifierString, target);
|
|
70
70
|
msg += listRegisteredBindingsForServiceIdentifier(container, serviceIdentifierString, getBindings);
|
|
71
|
+
if (parentRequest !== null) {
|
|
72
|
+
msg += "\n".concat(ERROR_MSGS.TRYING_TO_RESOLVE_BINDINGS(getServiceIdentifierAsString(parentRequest.serviceIdentifier)));
|
|
73
|
+
}
|
|
71
74
|
throw new Error(msg);
|
|
72
75
|
}
|
|
73
76
|
case BindingCount.OnlyOneBindingAvailable:
|
|
@@ -5,7 +5,7 @@ export declare const KEY_NOT_FOUND: string;
|
|
|
5
5
|
export declare const AMBIGUOUS_MATCH: string;
|
|
6
6
|
export declare const CANNOT_UNBIND: string;
|
|
7
7
|
export declare const NOT_REGISTERED: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const TRYING_TO_RESOLVE_BINDINGS: (name: string) => string;
|
|
9
9
|
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
10
10
|
export declare const CIRCULAR_DEPENDENCY: string;
|
|
11
11
|
export declare const INVALID_BINDING_TYPE: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.
|
|
3
|
+
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.TRYING_TO_RESOLVE_BINDINGS = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
|
|
4
4
|
exports.DUPLICATED_INJECTABLE_DECORATOR = 'Cannot apply @injectable decorator multiple times.';
|
|
5
5
|
exports.DUPLICATED_METADATA = 'Metadata key was used more than once in a parameter:';
|
|
6
6
|
exports.NULL_ARGUMENT = 'NULL argument';
|
|
@@ -8,7 +8,8 @@ exports.KEY_NOT_FOUND = 'Key Not Found';
|
|
|
8
8
|
exports.AMBIGUOUS_MATCH = 'Ambiguous match found for serviceIdentifier:';
|
|
9
9
|
exports.CANNOT_UNBIND = 'Could not unbind serviceIdentifier:';
|
|
10
10
|
exports.NOT_REGISTERED = 'No matching bindings found for serviceIdentifier:';
|
|
11
|
-
|
|
11
|
+
const TRYING_TO_RESOLVE_BINDINGS = (name) => `Trying to resolve bindings for "${name}"`;
|
|
12
|
+
exports.TRYING_TO_RESOLVE_BINDINGS = TRYING_TO_RESOLVE_BINDINGS;
|
|
12
13
|
const UNDEFINED_INJECT_ANNOTATION = (name) => `@inject called with undefined this could mean that the class ${name} has ` +
|
|
13
14
|
'a circular dependency problem. You can use a LazyServiceIdentifer to ' +
|
|
14
15
|
'overcome this limitation.';
|
package/es6/planning/planner.js
CHANGED
|
@@ -70,7 +70,7 @@ function _getActiveBindings(metadataReader, avoidConstraints, context, parentReq
|
|
|
70
70
|
else {
|
|
71
71
|
activeBindings = bindings;
|
|
72
72
|
}
|
|
73
|
-
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
|
|
73
|
+
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, parentRequest, target, context.container);
|
|
74
74
|
return activeBindings;
|
|
75
75
|
}
|
|
76
76
|
function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
@@ -85,7 +85,7 @@ function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
|
85
85
|
}
|
|
86
86
|
return metadataList;
|
|
87
87
|
}
|
|
88
|
-
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
88
|
+
function _validateActiveBindingCount(serviceIdentifier, bindings, parentRequest, target, container) {
|
|
89
89
|
switch (bindings.length) {
|
|
90
90
|
case binding_count_1.BindingCount.NoBindingsAvailable:
|
|
91
91
|
if (target.isOptional()) {
|
|
@@ -96,6 +96,9 @@ function _validateActiveBindingCount(serviceIdentifier, bindings, target, contai
|
|
|
96
96
|
let msg = ERROR_MSGS.NOT_REGISTERED;
|
|
97
97
|
msg += (0, serialization_1.listMetadataForTarget)(serviceIdentifierString, target);
|
|
98
98
|
msg += (0, serialization_1.listRegisteredBindingsForServiceIdentifier)(container, serviceIdentifierString, getBindings);
|
|
99
|
+
if (parentRequest !== null) {
|
|
100
|
+
msg += `\n${ERROR_MSGS.TRYING_TO_RESOLVE_BINDINGS((0, serialization_1.getServiceIdentifierAsString)(parentRequest.serviceIdentifier))}`;
|
|
101
|
+
}
|
|
99
102
|
throw new Error(msg);
|
|
100
103
|
}
|
|
101
104
|
case binding_count_1.BindingCount.OnlyOneBindingAvailable:
|
|
@@ -5,7 +5,7 @@ export declare const KEY_NOT_FOUND: string;
|
|
|
5
5
|
export declare const AMBIGUOUS_MATCH: string;
|
|
6
6
|
export declare const CANNOT_UNBIND: string;
|
|
7
7
|
export declare const NOT_REGISTERED: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const TRYING_TO_RESOLVE_BINDINGS: (name: string) => string;
|
|
9
9
|
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string;
|
|
10
10
|
export declare const CIRCULAR_DEPENDENCY: string;
|
|
11
11
|
export declare const INVALID_BINDING_TYPE: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.
|
|
3
|
+
exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.ON_DEACTIVATION_ERROR = exports.PRE_DESTROY_ERROR = exports.POST_CONSTRUCT_ERROR = exports.ASYNC_UNBIND_REQUIRED = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.MULTIPLE_PRE_DESTROY_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.LAZY_IN_SYNC = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.TRYING_TO_RESOLVE_BINDINGS = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
|
|
4
4
|
exports.DUPLICATED_INJECTABLE_DECORATOR = 'Cannot apply @injectable decorator multiple times.';
|
|
5
5
|
exports.DUPLICATED_METADATA = 'Metadata key was used more than once in a parameter:';
|
|
6
6
|
exports.NULL_ARGUMENT = 'NULL argument';
|
|
@@ -8,7 +8,8 @@ exports.KEY_NOT_FOUND = 'Key Not Found';
|
|
|
8
8
|
exports.AMBIGUOUS_MATCH = 'Ambiguous match found for serviceIdentifier:';
|
|
9
9
|
exports.CANNOT_UNBIND = 'Could not unbind serviceIdentifier:';
|
|
10
10
|
exports.NOT_REGISTERED = 'No matching bindings found for serviceIdentifier:';
|
|
11
|
-
|
|
11
|
+
var TRYING_TO_RESOLVE_BINDINGS = function (name) { return "Trying to resolve bindings for \"".concat(name, "\""); };
|
|
12
|
+
exports.TRYING_TO_RESOLVE_BINDINGS = TRYING_TO_RESOLVE_BINDINGS;
|
|
12
13
|
var UNDEFINED_INJECT_ANNOTATION = function (name) {
|
|
13
14
|
return "@inject called with undefined this could mean that the class ".concat(name, " has ") +
|
|
14
15
|
'a circular dependency problem. You can use a LazyServiceIdentifer to ' +
|
package/lib/planning/planner.js
CHANGED
|
@@ -70,7 +70,7 @@ function _getActiveBindings(metadataReader, avoidConstraints, context, parentReq
|
|
|
70
70
|
else {
|
|
71
71
|
activeBindings = bindings;
|
|
72
72
|
}
|
|
73
|
-
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container);
|
|
73
|
+
_validateActiveBindingCount(target.serviceIdentifier, activeBindings, parentRequest, target, context.container);
|
|
74
74
|
return activeBindings;
|
|
75
75
|
}
|
|
76
76
|
function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
@@ -85,7 +85,7 @@ function _getTargetMetadata(isMultiInject, serviceIdentifier, key, value) {
|
|
|
85
85
|
}
|
|
86
86
|
return metadataList;
|
|
87
87
|
}
|
|
88
|
-
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
88
|
+
function _validateActiveBindingCount(serviceIdentifier, bindings, parentRequest, target, container) {
|
|
89
89
|
switch (bindings.length) {
|
|
90
90
|
case binding_count_1.BindingCount.NoBindingsAvailable:
|
|
91
91
|
if (target.isOptional()) {
|
|
@@ -96,6 +96,9 @@ function _validateActiveBindingCount(serviceIdentifier, bindings, target, contai
|
|
|
96
96
|
var msg = ERROR_MSGS.NOT_REGISTERED;
|
|
97
97
|
msg += (0, serialization_1.listMetadataForTarget)(serviceIdentifierString, target);
|
|
98
98
|
msg += (0, serialization_1.listRegisteredBindingsForServiceIdentifier)(container, serviceIdentifierString, getBindings);
|
|
99
|
+
if (parentRequest !== null) {
|
|
100
|
+
msg += "\n".concat(ERROR_MSGS.TRYING_TO_RESOLVE_BINDINGS((0, serialization_1.getServiceIdentifierAsString)(parentRequest.serviceIdentifier)));
|
|
101
|
+
}
|
|
99
102
|
throw new Error(msg);
|
|
100
103
|
}
|
|
101
104
|
case binding_count_1.BindingCount.OnlyOneBindingAvailable:
|
package/package.json
CHANGED