mirror of
https://github.com/SerenityOS/serenity
synced 2026-04-25 17:15:42 +02:00
AK: Use ErrorOr::ErrorType in Json helpers
This commit is contained in:
@@ -16,7 +16,10 @@ namespace AK {
|
||||
|
||||
class JsonArray {
|
||||
template<typename Callback>
|
||||
using CallbackErrorType = decltype(declval<Callback>()(declval<JsonValue const&>()).release_error());
|
||||
using CallbackErrorType = decltype(declval<Callback>()(declval<JsonValue const&>()))::ErrorType;
|
||||
|
||||
static_assert(SameAs<CallbackErrorType<ErrorOr<void> (*)(JsonValue const&)>, Error>);
|
||||
static_assert(SameAs<ErrorOr<void, CallbackErrorType<ErrorOr<void> (*)(JsonValue const&)>>, ErrorOr<void>>);
|
||||
|
||||
public:
|
||||
JsonArray() = default;
|
||||
|
||||
@@ -20,7 +20,10 @@ namespace AK {
|
||||
|
||||
class JsonObject {
|
||||
template<typename Callback>
|
||||
using CallbackErrorType = decltype(declval<Callback>()(declval<ByteString const&>(), declval<JsonValue const&>()).release_error());
|
||||
using CallbackErrorType = decltype(declval<Callback>()(declval<ByteString const&>(), declval<JsonValue const&>()))::ErrorType;
|
||||
|
||||
static_assert(SameAs<CallbackErrorType<ErrorOr<void> (*)(ByteString const&, JsonValue const&)>, Error>);
|
||||
static_assert(SameAs<ErrorOr<void, CallbackErrorType<ErrorOr<void> (*)(ByteString const&, JsonValue const&)>>, ErrorOr<void>>);
|
||||
|
||||
public:
|
||||
JsonObject();
|
||||
|
||||
@@ -327,6 +327,9 @@ struct CustomError {
|
||||
template<typename T>
|
||||
class CustomErrorOr {
|
||||
public:
|
||||
using ResultType = T;
|
||||
using ErrorType = CustomError;
|
||||
|
||||
CustomErrorOr(T)
|
||||
: m_is_error(false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user