From a23cb1d61aa40e508980e1112d465e92f44d7c76 Mon Sep 17 00:00:00 2001 From: Robert Brignull Date: Fri, 1 May 2020 11:45:00 +0100 Subject: [PATCH] include status code is error message --- lib/upload-lib.js | 8 ++++---- src/upload-lib.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/upload-lib.js b/lib/upload-lib.js index a23f54c4b..e2dd3b32d 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -78,15 +78,15 @@ async function uploadPayload(payload) { const requestID = res.message.headers["x-github-request-id"]; // On any other status code that's not 5xx mark the upload as failed if (!statusCode || statusCode < 500 || statusCode >= 600) { - core.setFailed('Upload failed (' + requestID + '): ' + await res.readBody()); + core.setFailed('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody()); return; } // On a 5xx status code we may retry the request if (attempt < backoffPeriods.length) { // Log the failure as a warning but don't mark the action as failed yet core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) + - ') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] + ' seconds: ' + - await res.readBody()); + ') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] + + ' seconds: (' + statusCode + ') ' + await res.readBody()); // Sleep for the backoff period await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000)); continue; @@ -95,7 +95,7 @@ async function uploadPayload(payload) { // If the upload fails with 5xx then we assume it is a temporary problem // with turbo-scan and not an error that the user has caused or can fix. // We avoid marking the job as failed to avoid breaking CI workflows. - core.error('Upload failed (' + requestID + '): ' + await res.readBody()); + core.error('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody()); return; } } diff --git a/src/upload-lib.ts b/src/upload-lib.ts index d404b2685..bcb6056dd 100644 --- a/src/upload-lib.ts +++ b/src/upload-lib.ts @@ -78,7 +78,7 @@ async function uploadPayload(payload) { // On any other status code that's not 5xx mark the upload as failed if (!statusCode || statusCode < 500 || statusCode >= 600) { - core.setFailed('Upload failed (' + requestID + '): ' + await res.readBody()); + core.setFailed('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody()); return; } @@ -86,8 +86,8 @@ async function uploadPayload(payload) { if (attempt < backoffPeriods.length) { // Log the failure as a warning but don't mark the action as failed yet core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) + - ') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] + ' seconds: ' + - await res.readBody()); + ') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] + + ' seconds: (' + statusCode + ') ' + await res.readBody()); // Sleep for the backoff period await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000)); continue; @@ -96,7 +96,7 @@ async function uploadPayload(payload) { // If the upload fails with 5xx then we assume it is a temporary problem // with turbo-scan and not an error that the user has caused or can fix. // We avoid marking the job as failed to avoid breaking CI workflows. - core.error('Upload failed (' + requestID + '): ' + await res.readBody()); + core.error('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody()); return; } }