1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:07:36 +00:00

Everywhere: Make JSON serialization fallible

This allows us to eliminate a major source of infallible allocation in
the Kernel, as well as lay down the groundwork for OOM fallibility in
userland.
This commit is contained in:
Idan Horowitz 2022-02-24 20:08:48 +02:00 committed by Andreas Kling
parent 6682afb5d4
commit feb00b7105
18 changed files with 837 additions and 592 deletions

View file

@ -162,10 +162,11 @@ private:
template<typename Builder>
inline void JsonObject::serialize(Builder& builder) const
{
JsonObjectSerializer serializer { builder };
auto serializer = MUST(JsonObjectSerializer<>::try_create(builder));
for_each_member([&](auto& key, auto& value) {
serializer.add(key, value);
MUST(serializer.add(key, value));
});
MUST(serializer.finish());
}
template<typename Builder>