From 5a9f0761cea5b0c0963896b62bd74a74fc1152c9 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo <1102197+priyadi@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:32:13 +0700 Subject: [PATCH] fix: rethrow our exceptions in `writeTargetProperty`, fix confusing error message (#247) --- CHANGELOG.md | 5 +++++ .../Processor/ObjectProcessor/ObjectProcessor.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e231d43..106bde6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## 1.13.3 + +* fix: rethrow our exceptions in `writeTargetProperty`, fix confusing error + message + ## 1.13.2 * feat: `Map` now accepts false, for the more expressive `#[Map(false)]` diff --git a/src/Transformer/Processor/ObjectProcessor/ObjectProcessor.php b/src/Transformer/Processor/ObjectProcessor/ObjectProcessor.php index 2f8e5e2..950eed9 100644 --- a/src/Transformer/Processor/ObjectProcessor/ObjectProcessor.php +++ b/src/Transformer/Processor/ObjectProcessor/ObjectProcessor.php @@ -18,6 +18,7 @@ use Rekalogika\Mapper\Context\Context; use Rekalogika\Mapper\Context\ExtraTargetValues; use Rekalogika\Mapper\Context\MapperOptions; +use Rekalogika\Mapper\Exception\ExceptionInterface; use Rekalogika\Mapper\Exception\UnexpectedValueException; use Rekalogika\Mapper\MainTransformer\MainTransformerInterface; use Rekalogika\Mapper\ObjectCache\ObjectCache; @@ -1054,6 +1055,8 @@ public function writeTargetProperty( } } catch (\BadMethodCallException) { return $target; + } catch (ExceptionInterface $e) { + throw $e; } catch (\Throwable $e) { throw new UnableToWriteException( target: $target,