From 197acde4d488cf92e1006884dddd0c21de77427a Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 26 Aug 2019 04:53:22 +0300 Subject: [PATCH] Fix first letter case in error messages. GitOrigin-RevId: 004d1535d3fb04e51a088ad43f2386dea05b7c9c --- td/mtproto/RawConnection.h | 2 +- td/telegram/ConfigManager.cpp | 8 ++++---- td/telegram/MessagesDb.cpp | 2 +- td/telegram/SecureStorage.cpp | 2 +- td/telegram/files/FileHashUploader.cpp | 4 ++-- td/telegram/files/FileLoader.h | 4 ++-- tdutils/td/utils/port/Stat.cpp | 4 ++-- test/secret.cpp | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/td/mtproto/RawConnection.h b/td/mtproto/RawConnection.h index aeb0503be..5a816cab1 100644 --- a/td/mtproto/RawConnection.h +++ b/td/mtproto/RawConnection.h @@ -76,7 +76,7 @@ class RawConnection { virtual ~Callback() = default; virtual Status on_raw_packet(const PacketInfo &info, BufferSlice packet) = 0; virtual Status on_quick_ack(uint64 quick_ack_token) { - return Status::Error("quick acks unsupported fully, but still used"); + return Status::Error("Quick acks unsupported fully, but still used"); } virtual Status before_write() { return Status::OK(); diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 674cf382c..e15cf1c51 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -116,7 +116,7 @@ Result HttpDate::parse_http_date(std::string slice) { auto gmt = p.read_word(); TRY_STATUS(std::move(p.status())); if (gmt != "GMT") { - return Status::Error("timezone must be GMT"); + return Status::Error("Timezone must be GMT"); } static Slice month_names[12] = {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"}; @@ -177,7 +177,7 @@ Result decode_config(Slice input) { string hash(32, ' '); sha256(data_cbc.substr(0, 208), MutableSlice(hash)); if (data_cbc.substr(208) != Slice(hash).substr(0, 16)) { - return Status::Error("sha256 mismatch"); + return Status::Error("SHA256 mismatch"); } TlParser len_parser{data_cbc}; @@ -253,7 +253,7 @@ ActorOwn<> get_simple_config_google_dns(Promise promise, con res.r_config = [&]() -> Result { TRY_RESULT(json, json_decode(http_query->content_)); if (json.type() != JsonValue::Type::Object) { - return Status::Error("json error"); + return Status::Error("JSON error"); } auto &answer_object = json.get_object(); TRY_RESULT(answer, get_json_object_field(answer_object, "Answer", JsonValue::Type::Array, false)); @@ -261,7 +261,7 @@ ActorOwn<> get_simple_config_google_dns(Promise promise, con vector parts; for (auto &v : answer_array) { if (v.type() != JsonValue::Type::Object) { - return Status::Error("json error"); + return Status::Error("JSON error"); } auto &data_object = v.get_object(); TRY_RESULT(part, get_json_object_string_field(data_object, "data", false)); diff --git a/td/telegram/MessagesDb.cpp b/td/telegram/MessagesDb.cpp index 521fa653b..e49290774 100644 --- a/td/telegram/MessagesDb.cpp +++ b/td/telegram/MessagesDb.cpp @@ -400,7 +400,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface { Result> get_message_by_unique_message_id( ServerMessageId unique_message_id) override { if (!unique_message_id.is_valid()) { - return Status::Error("unique_message_id is invalid"); + return Status::Error("Invalid unique_message_id"); } SCOPE_EXIT { get_message_by_unique_message_id_stmt_.reset(); diff --git a/td/telegram/SecureStorage.cpp b/td/telegram/SecureStorage.cpp index 18c04de02..e9a2b54c3 100644 --- a/td/telegram/SecureStorage.cpp +++ b/td/telegram/SecureStorage.cpp @@ -174,7 +174,7 @@ static uint8 secret_checksum(Slice secret) { Result Secret::create(Slice secret) { if (secret.size() != 32) { - return Status::Error("wrong secret size"); + return Status::Error("Wrong secret size"); } uint32 checksum = secret_checksum(secret); if (checksum != 0) { diff --git a/td/telegram/files/FileHashUploader.cpp b/td/telegram/files/FileHashUploader.cpp index 1ac80e463..16c2280b5 100644 --- a/td/telegram/files/FileHashUploader.cpp +++ b/td/telegram/files/FileHashUploader.cpp @@ -39,7 +39,7 @@ Status FileHashUploader::init() { TRY_RESULT(fd, FileFd::open(local_.path_, FileFd::Read)); TRY_RESULT(file_size, fd.get_size()); if (file_size != size_) { - return Status::Error("size mismatch"); + return Status::Error("Size mismatch"); } fd_ = BufferedFd(std::move(fd)); sha256_state_.init(); @@ -94,7 +94,7 @@ Status FileHashUploader::loop_sha() { fd_.get_poll_info().add_flags(PollFlags::Read()); TRY_RESULT(read_size, fd_.flush_read(static_cast(limit))); if (read_size != static_cast(limit)) { - return Status::Error("unexpected end of file"); + return Status::Error("Unexpected end of file"); } while (true) { auto ready = fd_.input_buffer().prepare_read(); diff --git a/td/telegram/files/FileLoader.h b/td/telegram/files/FileLoader.h index d1044f8b2..855012d9a 100644 --- a/td/telegram/files/FileLoader.h +++ b/td/telegram/files/FileLoader.h @@ -86,14 +86,14 @@ class FileLoader : public FileLoaderActor { virtual Callback *get_callback() = 0; virtual Result on_update_local_location(const LocalFileLocation &location, int64 file_size) TD_WARN_UNUSED_RESULT { - return Status::Error("unsupported"); + return Status::Error("Unsupported"); } virtual Result should_restart_part(Part part, NetQueryPtr &net_query) TD_WARN_UNUSED_RESULT { return false; } virtual Status process_check_query(NetQueryPtr net_query) { - return Status::Error("unsupported"); + return Status::Error("Unsupported"); } struct CheckInfo { bool need_check{false}; diff --git a/tdutils/td/utils/port/Stat.cpp b/tdutils/td/utils/port/Stat.cpp index 96010bd5c..239594167 100644 --- a/tdutils/td/utils/port/Stat.cpp +++ b/tdutils/td/utils/port/Stat.cpp @@ -192,7 +192,7 @@ Result mem_stat() { if (KERN_SUCCESS != task_info(mach_task_self(), TASK_BASIC_INFO, reinterpret_cast(&t_info), &t_info_count)) { - return Status::Error("task_info failed"); + return Status::Error("Call to task_info failed"); } MemStat res; res.resident_size_ = t_info.resident_size; @@ -296,7 +296,7 @@ Status cpu_stat_self(CpuStat &stat) { s++; pass_cnt++; } else { - return Status::Error("unexpected end of proc file"); + return Status::Error("Unexpected end of proc file"); } } return Status::OK(); diff --git a/test/secret.cpp b/test/secret.cpp index 171d7da51..cab74359f 100644 --- a/test/secret.cpp +++ b/test/secret.cpp @@ -632,7 +632,7 @@ class Master : public Actor { int32 binlog_generation_ = 0; void sync_binlog(int32 binlog_generation, Promise<> promise) { if (binlog_generation != binlog_generation_) { - return promise.set_error(Status::Error("binlog generation mismatch")); + return promise.set_error(Status::Error("Binlog generation mismatch")); } binlog_->force_sync(std::move(promise)); } @@ -991,10 +991,10 @@ void FakeSecretChatContext::on_delete_messages(std::vector random_id, Pro promise.set_value(Unit()); } void FakeSecretChatContext::on_flush_history(MessageId, Promise<> promise) { - promise.set_error(Status::Error("unsupported")); + promise.set_error(Status::Error("Unsupported")); } void FakeSecretChatContext::on_read_message(int64, Promise<> promise) { - promise.set_error(Status::Error("unsupported")); + promise.set_error(Status::Error("Unsupported")); } TEST(Secret, go) {