mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
fix: use logging macros instead of emitting event directly, so that it is also logged by tracing (#7459)
The events are needed when you are not using chatmail core from rust, if you use chatmail core from your rust bot or from tauri, then you likely already use the rust logging/tracing ecosystem. So it makes sense to use it instead of listening to the events and logging them yourself. This pr fixes a few cases where the event was direclty emitted instead of using the macro and thus was not also automatically logged via tracing.
This commit is contained in:
@@ -16,7 +16,6 @@ use serde::Deserialize;
|
||||
use crate::config::Config;
|
||||
use crate::contact::{Contact, ContactId, Origin};
|
||||
use crate::context::Context;
|
||||
use crate::events::EventType;
|
||||
use crate::key::Fingerprint;
|
||||
use crate::login_param::{EnteredCertificateChecks, EnteredLoginParam, EnteredServerLoginParam};
|
||||
use crate::net::http::post_empty;
|
||||
@@ -824,9 +823,10 @@ pub(crate) async fn login_param_from_account_qr(
|
||||
match serde_json::from_str::<CreateAccountErrorResponse>(&response_text) {
|
||||
Ok(error) => Err(anyhow!(error.reason)),
|
||||
Err(parse_error) => {
|
||||
context.emit_event(EventType::Error(format!(
|
||||
error!(
|
||||
context,
|
||||
"Cannot create account, server response could not be parsed:\n{parse_error:#}\nraw response:\n{response_text}"
|
||||
)));
|
||||
);
|
||||
bail!("Cannot create account, unexpected server response:\n{response_text:?}")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user