diff --git a/src/Repository/RelationBuilder.php b/src/Repository/RelationBuilder.php index 7786bec..212aa3a 100644 --- a/src/Repository/RelationBuilder.php +++ b/src/Repository/RelationBuilder.php @@ -84,7 +84,8 @@ class RelationBuilder } } catch(\Throwable $e) { - throw new $e(sprintf("An error occurred while calling method from your #[Virtual] attribute in entity '%s::%s'. Caught '%s'", $this->entity::class, $name, $e->getMessage() )); + + throw new $e(sprintf("An error occurred while calling method from your #[Virtual] attribute in entity '%s::%s'. Caught '%s'", $this->entity::class, $name, $e->getMessage(), $e->getCode(), $e )); } }