From 5bb81303c24afc6fb1763f4fd3a08ceca8b4a3f0 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 23 Jun 2020 02:23:21 -0400 Subject: [PATCH] log database insertion errors --- tts_service/src/endpoints/speak.rs | 8 +++++--- tts_service/src/endpoints/speak_with_spectrogram.rs | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tts_service/src/endpoints/speak.rs b/tts_service/src/endpoints/speak.rs index 6653c7ff0f..86fc5ba12b 100644 --- a/tts_service/src/endpoints/speak.rs +++ b/tts_service/src/endpoints/speak.rs @@ -28,8 +28,9 @@ pub struct SpeakRequest { pub async fn post_speak(request: HttpRequest, query: Json, - app_state: Data> -) -> std::io::Result { + app_state: Data>) + -> std::io::Result +{ let app_state = app_state.into_inner(); let speaker_slug = query.speaker.to_string(); @@ -65,7 +66,8 @@ pub async fn post_speak(request: HttpRequest, }; match sentence_record.insert(&app_state.database_connector) { - Err(_) => error!("Could not insert sentence record for: {:?}", sentence_record), + Err(e) => error!("Could not insert sentence record for: {:?}, because: {:?}", + sentence_record, e), Ok(_) => {}, } diff --git a/tts_service/src/endpoints/speak_with_spectrogram.rs b/tts_service/src/endpoints/speak_with_spectrogram.rs index 0f00bc77a4..6254b2f677 100644 --- a/tts_service/src/endpoints/speak_with_spectrogram.rs +++ b/tts_service/src/endpoints/speak_with_spectrogram.rs @@ -86,7 +86,8 @@ pub async fn post_speak_with_spectrogram(request: HttpRequest, }; match sentence_record.insert(&app_state.database_connector) { - Err(_) => error!("Could not insert sentence record for: {:?}", sentence_record), + Err(e) => error!("Could not insert sentence record for: {:?}, because: {:?}", + sentence_record, e), Ok(_) => {}, }