diff --git a/lib/file_transfer_agent/gcs_util.js b/lib/file_transfer_agent/gcs_util.js index b72d9ef91..3cf6a0e2b 100644 --- a/lib/file_transfer_agent/gcs_util.js +++ b/lib/file_transfer_agent/gcs_util.js @@ -178,7 +178,7 @@ function GCSUtil(httpclient, filestream) { encryptionMetadata ); } catch (err) { - const errCode = err['code'] ? err['code'] : err.response.status; + const errCode = !isNaN(err['code']) && !isNaN(parseInt(err['code'])) ? err['code'] : err.response.status; if ([403, 408, 429, 500, 503].includes(errCode)) { meta['lastError'] = err;