LibMedia: Add formatter for decoder errors

This is useful for print debugging.
This commit is contained in:
Tim Ledbetter 2025-03-14 04:40:12 +00:00 committed by Jelle Raaijmakers
parent c270241b09
commit 411cafa2a9
Notes: github-actions[bot] 2025-03-14 07:48:57 +00:00

View file

@ -92,3 +92,15 @@ private:
#define DECODER_TRY_ALLOC(expression) DECODER_TRY(DecoderErrorCategory::Memory, expression)
}
namespace AK {
template<>
struct Formatter<Media::DecoderError> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, Media::DecoderError const& decoder_error)
{
return Formatter<FormatString>::format(builder, "[DecoderError]: {}"sv, decoder_error.description());
}
};
}