From b57eb121af72f6bd24c2a89002b0c00c5efd7718 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Wed, 5 Jun 2024 06:06:19 +0100 Subject: [PATCH] Err rather than panic failing to create queues_dir_path (#5079) --- quickwit/quickwit-ingest/src/queue.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quickwit/quickwit-ingest/src/queue.rs b/quickwit/quickwit-ingest/src/queue.rs index 234073f8c9d..63a6300f010 100644 --- a/quickwit/quickwit-ingest/src/queue.rs +++ b/quickwit/quickwit-ingest/src/queue.rs @@ -41,7 +41,15 @@ pub struct Queues { impl Queues { pub async fn open(queues_dir_path: &Path) -> crate::Result { - tokio::fs::create_dir_all(queues_dir_path).await.unwrap(); + tokio::fs::create_dir_all(queues_dir_path) + .await + .map_err(|error| { + IngestServiceError::IoError(format!( + "failed to create WAL directory `{}`: {}", + queues_dir_path.display(), + error + )) + })?; let record_log = MultiRecordLogAsync::open(queues_dir_path).await?; Ok(Queues { record_log }) }