mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:37:45 +00:00
AK: Convert AK::Format formatting helpers to returning ErrorOr<void>
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
This commit is contained in:
parent
008355c222
commit
216e21a1fa
87 changed files with 450 additions and 448 deletions
|
@ -85,15 +85,15 @@ namespace AK {
|
|||
|
||||
template<>
|
||||
struct Formatter<Core::FileWatcherEvent> : Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, const Core::FileWatcherEvent& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Core::FileWatcherEvent const& value)
|
||||
{
|
||||
Formatter<FormatString>::format(builder, "FileWatcherEvent(\"{}\", {})", value.event_path, value.type);
|
||||
return Formatter<FormatString>::format(builder, "FileWatcherEvent(\"{}\", {})", value.event_path, value.type);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Formatter<Core::FileWatcherEvent::Type> : Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, const Core::FileWatcherEvent::Type& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Core::FileWatcherEvent::Type const& value)
|
||||
{
|
||||
char const* type;
|
||||
switch (value) {
|
||||
|
@ -116,7 +116,7 @@ struct Formatter<Core::FileWatcherEvent::Type> : Formatter<FormatString> {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
builder.put_string(type);
|
||||
return builder.put_string(type);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue