Skip to content

Commit 438631c

Browse files
committed
Merge branch 'release/3.0.1'
2 parents 1dd9dbe + b417ba8 commit 438631c

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
All notable changes to this project will be documented in this file. This project adheres to
44
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
55

6+
## [3.0.1] - 2023-02-18
7+
8+
### Changed
9+
10+
- Update exceptions thrown when the encoding process fails to notify developer to check previous exception for the cause
11+
of the failure.
12+
613
## [3.0.0] - 2023-02-14
714

815
### Changed

src/Document.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ public function toArray()
160160
try {
161161
return json_decode($this->toJson(), true, 512, JSON_THROW_ON_ERROR);
162162
} catch (\Throwable $ex) {
163-
throw new \LogicException('Unable to convert document to an array.', 0, $ex);
163+
throw new \LogicException(
164+
'Unable to convert document to an array. See previous exception for cause of failure.',
165+
0,
166+
$ex,
167+
);
164168
}
165169
}
166170

@@ -174,7 +178,11 @@ public function jsonSerialize(): array
174178

175179
return $this->serialize();
176180
} catch (\Throwable $ex) {
177-
throw new \LogicException('Unable to serialize compound document.', 0, $ex);
181+
throw new \LogicException(
182+
'Unable to serialize compound document. See previous exception for cause of failure.',
183+
0,
184+
$ex,
185+
);
178186
}
179187
}
180188

@@ -190,7 +198,11 @@ public function toJson($options = 0)
190198

191199
return $this->encode();
192200
} catch (\Throwable $ex) {
193-
throw new \LogicException('Unable to encode compound document.', 0, $ex);
201+
throw new \LogicException(
202+
'Unable to encode compound document. See previous exception for cause of failure.',
203+
0,
204+
$ex,
205+
);
194206
}
195207
}
196208

0 commit comments

Comments
 (0)