diff --git a/src/Exception/NotFoundException.php b/src/Exception/NotFoundException.php index 162533d..ba85348 100644 --- a/src/Exception/NotFoundException.php +++ b/src/Exception/NotFoundException.php @@ -14,10 +14,11 @@ final class NotFoundException extends Exception implements NotFoundExceptionInte { private string $id; - public function __construct(string $id) + public function __construct(string $id, array $buildStack = []) { $this->id = $id; - parent::__construct("No definition or class found for \"$id\"."); + $buildStackMessage = $buildStack ? 'while building ' . implode(' -> ', $buildStack) : ''; + parent::__construct(sprintf('No definition or class found for "%s"%s.', $id, $buildStackMessage)); } public function getId(): string