diff --git a/src/acme2.js b/src/acme2.js index 538a058fa..4300b9c75 100644 --- a/src/acme2.js +++ b/src/acme2.js @@ -335,8 +335,8 @@ Acme2.prototype.downloadCertificate = async function (hostname, certUrl, certFil assert.strictEqual(typeof hostname, 'string'); assert.strictEqual(typeof certUrl, 'string'); - await promiseRetry({ times: 5, interval: 20000 }, async () => { - debug('downloadCertificate: downloading certificate'); + await promiseRetry({ times: 5, interval: 20000, debug }, async () => { + debug(`downloadCertificate: downloading certificate of ${hostname}`); const result = await this.postAsGet(certUrl); if (result.statusCode === 202) throw new BoxError(BoxError.ACME_ERROR, 'Retry downloading certificate'); diff --git a/src/promise-retry.js b/src/promise-retry.js index c2a47772f..ff59b9f49 100644 --- a/src/promise-retry.js +++ b/src/promise-retry.js @@ -17,6 +17,7 @@ async function promiseRetry(options, asyncFunction) { return await asyncFunction(); } catch (error) { if (i === times - 1) throw error; + if (options.debug) options.debug(`Attempt ${i+1} failed. Will retry: ${error.message}`); await delay(interval); } }