diff --git a/AK/Format.h b/AK/Format.h index 90f2b5bf18..36221884d9 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -624,6 +624,16 @@ struct Formatter : Formatter { } }; +template +struct Formatter> : Formatter { + ErrorOr format(FormatBuilder& builder, ErrorOr const& error_or) + { + if (error_or.is_error()) + return Formatter::format(builder, "{}", error_or.error()); + return Formatter::format(builder, "{{{}}}", error_or.value()); + } +}; + } // namespace AK #ifdef KERNEL