From 44527a16090f824d15750b1d45c5abda8d8c3c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Dallidet?= Date: Thu, 21 Dec 2023 16:27:56 +0100 Subject: [PATCH] Fixes #23951: Fix some small things in rudder-package --- .../sources/rudder-package/src/repository.rs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/relay/sources/rudder-package/src/repository.rs b/relay/sources/rudder-package/src/repository.rs index 9943c6fbcf..570ce70dd6 100644 --- a/relay/sources/rudder-package/src/repository.rs +++ b/relay/sources/rudder-package/src/repository.rs @@ -20,7 +20,7 @@ use crate::{ config::{Configuration, Credentials}, signature::{SignatureVerifier, VerificationSuccess}, webapp::Webapp, - LICENSES_FOLDER, REPOSITORY_INDEX_PATH, + CONFIG_PATH, LICENSES_FOLDER, REPOSITORY_INDEX_PATH, }; static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),); @@ -79,11 +79,24 @@ impl Repository { let res = req.send()?; // Special error messages for common errors + let error_conf_msg = format!("Please check your configuration in {}", CONFIG_PATH); match res.status() { - StatusCode::UNAUTHORIZED => bail!("Received an HTTP 401 Unauthorized error when trying to get {}. Please check your credentials in the configuration.", path), - StatusCode::FORBIDDEN => bail!("Received an HTTP 403 Forbidden error when trying to get {}. Please check your credentials in the configuration.", path), - StatusCode::NOT_FOUND => bail!("Received an HTTP 404 Not found error when trying to get {}. Please check your configuration.", path), - _ => () + StatusCode::UNAUTHORIZED => bail!( + "Received an HTTP 401 Unauthorized error when trying to get {}. {}.", + path, + error_conf_msg + ), + StatusCode::FORBIDDEN => bail!( + "Received an HTTP 403 Forbidden error when trying to get {}. {}.", + path, + error_conf_msg + ), + StatusCode::NOT_FOUND => bail!( + "Received an HTTP 404 Not found error when trying to get {}. {}.", + path, + error_conf_msg + ), + _ => (), } Ok(res.error_for_status()?)