@@ -117,7 +117,7 @@ export class HooksService implements IHooksService {
117
117
118
118
this . $logger . trace ( `Validating ${ hookName } arguments.` ) ;
119
119
120
- const invalidArguments = this . validateHookArguments ( hookEntryPoint ) ;
120
+ const invalidArguments = this . validateHookArguments ( hookEntryPoint , hook . fullPath ) ;
121
121
122
122
if ( invalidArguments . length ) {
123
123
this . $logger . warn ( `${ hook . fullPath } will NOT be executed because it has invalid arguments - ${ invalidArguments . join ( ", " ) . grey } .` ) ;
@@ -144,6 +144,8 @@ export class HooksService implements IHooksService {
144
144
if ( err && _ . isBoolean ( err . stopExecution ) && err . errorAsWarning === true ) {
145
145
this . $logger . warn ( err . message || err ) ;
146
146
} else {
147
+ // Print the actual error with its callstack, so it is easy to find out which hooks is causing troubles.
148
+ this . $logger . error ( err ) ;
147
149
throw err || new Error ( `Failed to execute hook: ${ hook . fullPath } .` ) ;
148
150
}
149
151
}
@@ -266,7 +268,7 @@ export class HooksService implements IHooksService {
266
268
}
267
269
}
268
270
269
- private validateHookArguments ( hookConstructor : Function ) : string [ ] {
271
+ private validateHookArguments ( hookConstructor : Function , hookFullPath : string ) : string [ ] {
270
272
const invalidArguments : string [ ] = [ ] ;
271
273
272
274
// We need to annotate the hook in order to have the arguments of the constructor.
@@ -278,7 +280,7 @@ export class HooksService implements IHooksService {
278
280
this . $injector . resolve ( argument ) ;
279
281
}
280
282
} catch ( err ) {
281
- this . $logger . trace ( `Cannot resolve ${ argument } , reason: ${ err } ` ) ;
283
+ this . $logger . trace ( `Cannot resolve ${ argument } of hook ${ hookFullPath } , reason: ${ err } ` ) ;
282
284
invalidArguments . push ( argument ) ;
283
285
}
284
286
} ) ;
0 commit comments