Skip to content

Commit

Permalink
Catch any throwable
Browse files Browse the repository at this point in the history
JsonSerializable interface means any exception could be thrown from json_encode/decode.
  • Loading branch information
trowski committed Mar 24, 2020
1 parent 56ce013 commit c81a736
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/JsonSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function serialize($data): string
default:
throw new SerializationException(\json_last_error_msg(), $code);
}
} catch (\JsonException $exception) {
} catch (\Throwable $exception) {
throw new SerializationException($exception->getMessage(), $exception->getCode(), $exception);
}
}
Expand All @@ -81,7 +81,7 @@ public function unserialize(string $data)
default:
throw new SerializationException(\json_last_error_msg(), $code);
}
} catch (\JsonException $exception) {
} catch (\Throwable $exception) {
throw new SerializationException($exception->getMessage(), $exception->getCode(), $exception);
}
}
Expand Down

0 comments on commit c81a736

Please sign in to comment.