From 00ca24fd7f3a9f7252b54e9007635a76d9f00cd8 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Tue, 26 Aug 2025 13:25:03 +0200 Subject: [PATCH] Favor server message when displaying upload error for 413 status --- src/api.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/api.rs b/src/api.rs index cd8087c..2441c82 100644 --- a/src/api.rs +++ b/src/api.rs @@ -62,10 +62,18 @@ pub async fn create_recording(path: &str, config: &Config) -> Result().await { + Ok(json) => { + bail!("{}", json.message); + } - response.error_for_status_ref()?; + Err(_) => { + bail!("The recording exceeds the server-configured size limit"); + } + } + } else { + response.error_for_status_ref()?; + } Ok(response.json::().await?) }