From af69f511b5169bf0f9e9ade2d50bfca7229054d1 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 6 Feb 2022 20:27:48 +0100 Subject: [PATCH] Generate error events for deserialization failures --- src/client.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/client.rs b/src/client.rs index 531bb83..1334140 100644 --- a/src/client.rs +++ b/src/client.rs @@ -12,7 +12,7 @@ use tokio_rustls::client::TlsStream; use tokio_rustls::rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName}; #[cfg(feature = "tokio-rustls")] use tokio_rustls::TlsConnector; -use tracing::info; +use tracing::{error, info}; use crate::common::{Certificate, NoExtension, PrivateKey}; pub use crate::connection::Connector; @@ -129,7 +129,13 @@ impl EppClient { 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.