Fix UTF-8 encoding check of a string.

This commit is contained in:
levlam 2023-11-15 13:44:29 +03:00
parent efa6e20ba2
commit 247c28d6e7
1 changed files with 4 additions and 4 deletions

View File

@ -83,11 +83,11 @@ string oneline(Slice str) {
namespace detail {
Status get_to_integer_safe_error(Slice str) {
auto status = Status::Error(PSLICE() << "Can't parse \"" << str << "\" as an integer");
if (!check_utf8(status.message())) {
status = Status::Error("Strings must be encoded in UTF-8");
auto error_message = PSTRING() << "Can't parse as an integer string \"" << str << '"';
if (!check_utf8(error_message)) {
return Status::Error("Strings must be encoded in UTF-8");
}
return status;
return Status::Error(error_message);
}
} // namespace detail