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

LibVideo: Remove control codes from DecoderError location information

This commit is contained in:
Zaggy1024 2022-11-09 07:18:54 -06:00 committed by Ali Mohammad Pur
parent 18a6a1dd10
commit 6f28c8deb0

View file

@ -46,9 +46,14 @@ public:
return DecoderError::with_description(category, String::vformatted(format_string.view(), variadic_format_params)); return DecoderError::with_description(category, String::vformatted(format_string.view(), variadic_format_params));
} }
static DecoderError from_source_location(DecoderErrorCategory category, StringView description, SourceLocation location = SourceLocation::current())
{
return DecoderError::format(category, "[{} @ {}:{}]: {}", location.function_name(), location.filename(), location.line_number(), description);
}
static DecoderError corrupted(StringView description, SourceLocation location = SourceLocation::current()) static DecoderError corrupted(StringView description, SourceLocation location = SourceLocation::current())
{ {
return DecoderError::format(DecoderErrorCategory::Corrupted, "{}: {}", location, description); return DecoderError::from_source_location(DecoderErrorCategory::Corrupted, description, location);
} }
static DecoderError not_implemented(SourceLocation location = SourceLocation::current()) static DecoderError not_implemented(SourceLocation location = SourceLocation::current())
@ -76,9 +81,8 @@ private:
auto _result = ((expression)); \ auto _result = ((expression)); \
if (_result.is_error()) [[unlikely]] { \ if (_result.is_error()) [[unlikely]] { \
auto _error_string = _result.release_error().string_literal(); \ auto _error_string = _result.release_error().string_literal(); \
return DecoderError::format( \ return DecoderError::from_source_location( \
((category)), "{}: {}", \ ((category)), _error_string, SourceLocation::current()); \
SourceLocation::current(), _error_string); \
} \ } \
_result.release_value(); \ _result.release_value(); \
}) })