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

Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>

We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace!
This was a slightly tedious refactoring that took a long time, so it's
not unlikely that some bugs crept in.

Nevertheless, it does pass basic functionality testing, and it's just
real nice to finally see the same pattern in all contexts. :^)
This commit is contained in:
Andreas Kling 2021-11-08 00:51:39 +01:00
parent 7ee10c6926
commit 79fa9765ca
262 changed files with 2415 additions and 2600 deletions

View file

@ -18,21 +18,21 @@ class KBufferBuilder {
public:
using OutputType = KBuffer;
static KResultOr<KBufferBuilder> try_create();
static ErrorOr<KBufferBuilder> try_create();
KBufferBuilder(KBufferBuilder&&) = default;
KBufferBuilder& operator=(KBufferBuilder&&) = default;
~KBufferBuilder() = default;
KResult append(const StringView&);
KResult append(char);
KResult append(const char*, int);
ErrorOr<void> append(const StringView&);
ErrorOr<void> append(char);
ErrorOr<void> append(const char*, int);
KResult append_escaped_for_json(const StringView&);
KResult append_bytes(ReadonlyBytes);
ErrorOr<void> append_escaped_for_json(const StringView&);
ErrorOr<void> append_bytes(ReadonlyBytes);
template<typename... Parameters>
KResult appendff(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
ErrorOr<void> appendff(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
{
// FIXME: This really not ideal, but vformat expects StringBuilder.
StringBuilder builder;