Avoid expected logging for failed secret chats.
This commit is contained in:
parent
83fdbd7859
commit
70f4e9d3cc
@ -633,13 +633,15 @@ void SecretChatActor::check_status(Status status) {
|
|||||||
if (status.code() == 1) {
|
if (status.code() == 1) {
|
||||||
LOG(WARNING) << "Non-fatal error: " << status;
|
LOG(WARNING) << "Non-fatal error: " << status;
|
||||||
} else {
|
} else {
|
||||||
on_fatal_error(std::move(status));
|
on_fatal_error(std::move(status), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SecretChatActor::on_fatal_error(Status status) {
|
void SecretChatActor::on_fatal_error(Status status, bool is_expected) {
|
||||||
LOG(ERROR) << "Fatal error: " << status;
|
if (!is_expected) {
|
||||||
|
LOG(ERROR) << "Fatal error: " << status;
|
||||||
|
}
|
||||||
cancel_chat(false, false, Promise<>());
|
cancel_chat(false, false, Promise<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1650,19 +1652,9 @@ void SecretChatActor::on_outbound_send_message_error(uint64 state_id, Status err
|
|||||||
state = outbound_message_states_.get(state_id);
|
state = outbound_message_states_.get(state_id);
|
||||||
need_sync = true;
|
need_sync = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (error.code() != 429) {
|
||||||
bool should_fail = false;
|
return on_fatal_error(std::move(error),
|
||||||
if (error.code() == 429) {
|
(error.code() == 400 && error.message() == "ENCRYPTION_DECLINED") || error.code() == 403);
|
||||||
should_fail = false;
|
|
||||||
} else if (error.code() == 400 && error.message() == "ENCRYPTION_DECLINED") {
|
|
||||||
should_fail = true;
|
|
||||||
} else {
|
|
||||||
LOG(ERROR) << "Got unknown error for encrypted service message: " << error;
|
|
||||||
should_fail = true;
|
|
||||||
}
|
|
||||||
if (should_fail) {
|
|
||||||
return on_fatal_error(std::move(error));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
auto query = create_net_query(*state->message);
|
auto query = create_net_query(*state->message);
|
||||||
state->net_query_id = query->id();
|
state->net_query_id = query->id();
|
||||||
|
@ -637,7 +637,7 @@ class SecretChatActor final : public NetQueryCallback {
|
|||||||
void outbound_loop(OutboundMessageState *state, uint64 state_id);
|
void outbound_loop(OutboundMessageState *state, uint64 state_id);
|
||||||
|
|
||||||
// DiscardEncryption
|
// DiscardEncryption
|
||||||
void on_fatal_error(Status status);
|
void on_fatal_error(Status status, bool is_expected);
|
||||||
void do_close_chat_impl(bool delete_history, bool is_already_discarded, uint64 log_event_id, Promise<Unit> &&promise);
|
void do_close_chat_impl(bool delete_history, bool is_already_discarded, uint64 log_event_id, Promise<Unit> &&promise);
|
||||||
void on_closed(uint64 log_event_id, Promise<Unit> &&promise);
|
void on_closed(uint64 log_event_id, Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user