File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ export class InvalidBindingError extends Error {
163163 message :string ;
164164 constructor ( binding ) {
165165 super ( ) ;
166- this . message = `Invalid binding ${ binding } ` ;
166+ this . message = `Invalid binding - only instances of Binding and Type are allowed, got: ${ binding } ` ;
167167 }
168168
169169 toString ( ) :string {
Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ function _resolveBindings(bindings:List): List {
379379 } else if ( unresolved instanceof List ) {
380380 resolved = _resolveBindings ( unresolved ) ;
381381 } else if ( unresolved instanceof BindingBuilder ) {
382- throw new InvalidBindingError ( unresolved . token ) ;
382+ throw new InvalidBindingError ( 'BindingBuilder with ' + unresolved . token + ' token' ) ;
383383 } else {
384384 throw new InvalidBindingError ( unresolved ) ;
385385 }
Original file line number Diff line number Diff line change @@ -205,8 +205,11 @@ export function main() {
205205 } ) ;
206206
207207 it ( 'should throw when given invalid bindings' , function ( ) {
208- expect ( ( ) => Injector . resolveAndCreate ( [ "blah" ] ) ) . toThrowError ( 'Invalid binding blah' ) ;
209- expect ( ( ) => Injector . resolveAndCreate ( [ bind ( "blah" ) ] ) ) . toThrowError ( 'Invalid binding blah' ) ;
208+ expect ( ( ) => Injector . resolveAndCreate ( [ "blah" ] ) )
209+ . toThrowError ( 'Invalid binding - only instances of Binding and Type are allowed, got: blah' ) ;
210+ expect ( ( ) => Injector . resolveAndCreate ( [ bind ( "blah" ) ] ) )
211+ . toThrowError ( 'Invalid binding - only instances of Binding and Type are allowed, ' +
212+ 'got: BindingBuilder with blah token' ) ;
210213 } ) ;
211214
212215 it ( 'should provide itself' , function ( ) {
You can’t perform that action at this time.
0 commit comments