diff --git a/services/hooks-service.ts b/services/hooks-service.ts index de284b85..7c244fa3 100644 --- a/services/hooks-service.ts +++ b/services/hooks-service.ts @@ -66,9 +66,14 @@ export class HooksService implements IHooksService { private executeHooks(hookName: string, hookArguments?: IDictionary): IFuture { return (() => { - _.each(this.hooksDirectories, hooksDirectory => { - this.executeHooksInDirectory(hooksDirectory, hookName, hookArguments).wait(); - }); + try { + _.each(this.hooksDirectories, hooksDirectory => { + this.executeHooksInDirectory(hooksDirectory, hookName, hookArguments).wait(); + }); + } catch(err) { + this.$logger.trace("Failed during hook execution."); + this.$errors.failWithoutHelp(err.message); + } }).future()(); } @@ -104,7 +109,7 @@ export class HooksService implements IHooksService { let output = this.$childProcess.spawnFromEvent(command, [hook.fullPath], "close", environment, { throwError: false }).wait(); if (output.exitCode !== 0) { - this.$errors.fail(output.stdout + output.stderr); + throw new Error(output.stdout + output.stderr); } } });