Skip to content

Commit 3e5a5e1

Browse files
committed
Exception callback removed
Coverage 100%
1 parent d2e9c8a commit 3e5a5e1

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

src/HooksPipeline.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@ public function withCallback(Closure $callback)
4545
return $this;
4646
}
4747

48-
/**
49-
* @param Closure $callback
50-
* @return $this
51-
*/
52-
public function withExceptionCallback(Closure $callback)
53-
{
54-
$this->exceptionCallback = $callback;
55-
56-
return $this;
57-
}
58-
5948
/**
6049
* Get a Closure that represents a slice of the application onion.
6150
*
@@ -102,16 +91,4 @@ protected function carry()
10291
};
10392
};
10493
}
105-
106-
/**
107-
* {@inheritDoc}
108-
*/
109-
protected function handleException($passable, $e)
110-
{
111-
if ($this->exceptionCallback) {
112-
return call_user_func_array($this->exceptionCallback, [$e]);
113-
}
114-
115-
throw $e;
116-
}
11794
}

src/Traits/WithPipeline.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ protected function makePipeline(): Pipeline
2121

2222
return $pipeline
2323
->through($this->getRegisteredHooks())
24-
->withCallback($this->showInfoAboutHook())
25-
->withExceptionCallback($this->showHookErrorAndExit());
24+
->withCallback($this->showInfoAboutHook());
2625
}
2726

2827
/**
@@ -37,22 +36,6 @@ protected function showInfoAboutHook(): Closure
3736
};
3837
}
3938

40-
/**
41-
* Show Exception message and exit
42-
*
43-
* @return Closure
44-
*/
45-
protected function showHookErrorAndExit(): Closure
46-
{
47-
return function (Throwable $e) {
48-
$message = $e->getMessage() ? ' - '.$e->getMessage() : '';
49-
$message = sprintf('%s failed%s.', $this->getHook(), $message);
50-
51-
$this->getOutput()->writeln(' <bg=red;fg=white> ERROR </> '.$message.PHP_EOL);
52-
exit(1);
53-
};
54-
}
55-
5639
/**
5740
* {@inheritDoc}
5841
*/

0 commit comments

Comments
 (0)