diff --git a/src/v/cloud_storage/cache_service.cc b/src/v/cloud_storage/cache_service.cc index dc6b437a45780..3a4e8c1653726 100644 --- a/src/v/cloud_storage/cache_service.cc +++ b/src/v/cloud_storage/cache_service.cc @@ -1311,14 +1311,15 @@ ss::future<> cache::put( if (!_gate.is_closed()) { auto delete_tmp_fut = co_await ss::coroutine::as_future( delete_file_and_empty_parents(tmp_filepath.native())); - if ( - delete_tmp_fut.failed() - && !ssx::is_shutdown_exception(delete_tmp_fut.get_exception())) { - vlog( - cst_log.error, - "Failed to delete tmp file {}: {}", - tmp_filepath.native(), - delete_tmp_fut.get_exception()); + if (delete_tmp_fut.failed()) { + auto e = delete_tmp_fut.get_exception(); + if (!ssx::is_shutdown_exception(e)) { + vlog( + cst_log.error, + "Failed to delete tmp file {}: {}", + tmp_filepath.native(), + e); + } } }