From df862c1655667753b9504c27a4eef097bd3d39f5 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Fri, 31 Oct 2025 16:10:40 +0100 Subject: [PATCH] libstore/s3: attach more information to error messages In case of empty messages, it is good to print the raw error code. Additionally, we print request IDs which can help users to reconcile what happened with the service provider. Change-Id: I4d83c011c1b7a5514e3d1b21123df38308279044 Signed-off-by: Raito Bezarius --- lix/libstore/s3-binary-cache-store.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lix/libstore/s3-binary-cache-store.cc b/lix/libstore/s3-binary-cache-store.cc index adbaa3038..24fbcd9fa 100644 --- a/lix/libstore/s3-binary-cache-store.cc +++ b/lix/libstore/s3-binary-cache-store.cc @@ -159,11 +159,24 @@ class RetryStrategy : public Aws::Client::DefaultRetryStrategy bool ShouldRetry(const Aws::Client::AWSError& error, long attemptedRetries) const override { auto retry = Aws::Client::DefaultRetryStrategy::ShouldRetry(error, attemptedRetries); - if (retry) - printError("AWS error '%s' (%s), will retry in %d ms", - error.GetExceptionName(), - error.GetMessage(), - CalculateDelayBeforeNextRetry(error, attemptedRetries)); + if (retry) { + if (error.GetExceptionName() != "") { + printError( + "AWS error '%s' (%s) on request ID '%s', will retry in %d ms", + error.GetExceptionName(), + error.GetMessage(), + error.GetRequestId(), + CalculateDelayBeforeNextRetry(error, attemptedRetries) + ); + } else { + printError( + "AWS error (error type: %d) on request ID '%s', will retry in %d ms", + error.GetErrorType(), + error.GetRequestId(), + CalculateDelayBeforeNextRetry(error, attemptedRetries) + ); + } + } return retry; } };