mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:47:34 +00:00
AK+Userland: Make AK::decode_hex() return ErrorOr
This lets us propagate the reason why it failed up to the caller. :^)
This commit is contained in:
parent
45cf40653a
commit
f590cd1850
6 changed files with 31 additions and 33 deletions
|
@ -77,8 +77,8 @@ Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId
|
|||
|
||||
case OPTION_HEX_VALUE: {
|
||||
auto decoded = decode_hex(text_value.replace(" ", "", true));
|
||||
if (!decoded.has_value())
|
||||
return String("Input contains invalid hex values.");
|
||||
if (decoded.is_error())
|
||||
return String::formatted("Input is invalid: {}", decoded.error().string_literal());
|
||||
|
||||
return decoded.value();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue