Generate error events for deserialization failures

This commit is contained in:
Dirkjan Ochtman 2022-02-06 20:27:48 +01:00
parent 9d420ad20b
commit 11ae0a3081
1 changed files with 8 additions and 2 deletions

View File

@ -12,7 +12,7 @@ use tokio_rustls::client::TlsStream;
use tokio_rustls::rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName}; use tokio_rustls::rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName};
#[cfg(feature = "tokio-rustls")] #[cfg(feature = "tokio-rustls")]
use tokio_rustls::TlsConnector; use tokio_rustls::TlsConnector;
use tracing::info; use tracing::{error, info};
use crate::common::{Certificate, NoExtension, PrivateKey}; use crate::common::{Certificate, NoExtension, PrivateKey};
pub use crate::connection::Connector; pub use crate::connection::Connector;
@ -129,7 +129,13 @@ impl<C: Connector> EppClient<C> {
let response = self.connection.transact(&epp_xml).await?; let response = self.connection.transact(&epp_xml).await?;
Cmd::deserialize_response(&response) match Cmd::deserialize_response(&response) {
Ok(response) => Ok(response),
Err(e) => {
error!(%response, "Failed to deserialize response: {}", e);
Err(e)
}
}
} }
/// Accepts raw EPP XML and returns the raw EPP XML response to it. /// Accepts raw EPP XML and returns the raw EPP XML response to it.