Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 9f4d4e9

Browse files
Merge pull request #552 from telerik/vladimirov/hooks-skip-help
Do not show help when hook fails
2 parents 923bcdb + b215708 commit 9f4d4e9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

services/hooks-service.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@ export class HooksService implements IHooksService {
6666

6767
private executeHooks(hookName: string, hookArguments?: IDictionary<any>): IFuture<void> {
6868
return (() => {
69-
_.each(this.hooksDirectories, hooksDirectory => {
70-
this.executeHooksInDirectory(hooksDirectory, hookName, hookArguments).wait();
71-
});
69+
try {
70+
_.each(this.hooksDirectories, hooksDirectory => {
71+
this.executeHooksInDirectory(hooksDirectory, hookName, hookArguments).wait();
72+
});
73+
} catch(err) {
74+
this.$logger.trace("Failed during hook execution.");
75+
this.$errors.failWithoutHelp(err.message);
76+
}
7277
}).future<void>()();
7378
}
7479

@@ -104,7 +109,7 @@ export class HooksService implements IHooksService {
104109

105110
let output = this.$childProcess.spawnFromEvent(command, [hook.fullPath], "close", environment, { throwError: false }).wait();
106111
if (output.exitCode !== 0) {
107-
this.$errors.fail(output.stdout + output.stderr);
112+
throw new Error(output.stdout + output.stderr);
108113
}
109114
}
110115
});

0 commit comments

Comments
 (0)