@@ -117,7 +117,7 @@ export class HooksService implements IHooksService {
117117
118118 this . $logger . trace ( `Validating ${ hookName } arguments.` ) ;
119119
120- const invalidArguments = this . validateHookArguments ( hookEntryPoint ) ;
120+ const invalidArguments = this . validateHookArguments ( hookEntryPoint , hook . fullPath ) ;
121121
122122 if ( invalidArguments . length ) {
123123 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 {
144144 if ( err && _ . isBoolean ( err . stopExecution ) && err . errorAsWarning === true ) {
145145 this . $logger . warn ( err . message || err ) ;
146146 } 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 ) ;
147149 throw err || new Error ( `Failed to execute hook: ${ hook . fullPath } .` ) ;
148150 }
149151 }
@@ -266,7 +268,7 @@ export class HooksService implements IHooksService {
266268 }
267269 }
268270
269- private validateHookArguments ( hookConstructor : Function ) : string [ ] {
271+ private validateHookArguments ( hookConstructor : Function , hookFullPath : string ) : string [ ] {
270272 const invalidArguments : string [ ] = [ ] ;
271273
272274 // We need to annotate the hook in order to have the arguments of the constructor.
@@ -278,7 +280,7 @@ export class HooksService implements IHooksService {
278280 this . $injector . resolve ( argument ) ;
279281 }
280282 } catch ( err ) {
281- this . $logger . trace ( `Cannot resolve ${ argument } , reason: ${ err } ` ) ;
283+ this . $logger . trace ( `Cannot resolve ${ argument } of hook ${ hookFullPath } , reason: ${ err } ` ) ;
282284 invalidArguments . push ( argument ) ;
283285 }
284286 } ) ;
0 commit comments