geekcell / ddd-symfony-bundle

A bundle for pragmatic domain driven design in Symfony.
https://www.geekcell.io
MIT License
7 stars 1 forks source link

fix: logic to throw first wrapped exception in messenger busses #48

Closed Bl00D4NGEL closed 10 months ago

Bl00D4NGEL commented 10 months ago

In https://github.com/geekcell/ddd-symfony-bundle/pull/46 the getNestedExceptions call was replaced with getWrappedExceptions, however the returned array from getWrappedExceptions is an associate array where the exception name is the key, previously the array was just a list.

This PR fixes the behaviour so that we array_shift off the first exception from the wrapped exceptions array and throw it if it's thruthy. Otherwise throw the HandlerFailedException itself