From eb502ecd3970aa6f75f479c5f23c32fce2fabbd0 Mon Sep 17 00:00:00 2001 From: codeliner Date: Mon, 23 Oct 2017 11:59:06 +0200 Subject: [PATCH 1/2] Catch throwable and reset isDispatching --- src/CommandBus.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CommandBus.php b/src/CommandBus.php index 15912b8..1713013 100644 --- a/src/CommandBus.php +++ b/src/CommandBus.php @@ -74,6 +74,9 @@ public function dispatch($command) $this->processCommand($command); } $this->isDispatching = false; + } catch (\Throwable $ex) { + $this->isDispatching = false; + throw $ex; } catch (\Exception $e) { $this->isDispatching = false; throw CommandDispatchException::wrap($e, $this->commandQueue); From b461530f3df82fa75e105cafaade4e3cd2bc80fe Mon Sep 17 00:00:00 2001 From: codeliner Date: Mon, 23 Oct 2017 12:11:14 +0200 Subject: [PATCH 2/2] Change catch order --- src/CommandBus.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CommandBus.php b/src/CommandBus.php index 1713013..4302d76 100644 --- a/src/CommandBus.php +++ b/src/CommandBus.php @@ -74,12 +74,12 @@ public function dispatch($command) $this->processCommand($command); } $this->isDispatching = false; - } catch (\Throwable $ex) { - $this->isDispatching = false; - throw $ex; } catch (\Exception $e) { $this->isDispatching = false; throw CommandDispatchException::wrap($e, $this->commandQueue); + } catch (\Throwable $e) { + $this->isDispatching = false; + throw $e; } } }