1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-03 10:07:49 +01:00

Attach oringal exception message to SerializationException

Related to #103.
This commit is contained in:
Aaron Piotrowski 2020-02-27 22:44:51 -06:00
parent 346d3f5093
commit 15ead6c976
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -21,7 +21,7 @@ final class ChannelParser extends Parser
* *
* @return string Encoded data that can be parsed by this class. * @return string Encoded data that can be parsed by this class.
* *
* @throws \Amp\Parallel\Sync\SerializationException * @throws SerializationException
*/ */
public function encode($data): string public function encode($data): string
{ {
@ -29,7 +29,7 @@ final class ChannelParser extends Parser
$data = \serialize($data); $data = \serialize($data);
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
throw new SerializationException( throw new SerializationException(
"The given data cannot be sent because it is not serializable.", \sprintf("The given data cannot be sent because it is not serializable: %s", $exception->getMessage()),
0, 0,
$exception $exception
); );