Skip to content

Commit

Permalink
Rename some variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecote committed Dec 30, 2020
1 parent 3f5a53a commit bbdea96
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions x-pack/plugins/actions/server/builtin_action_types/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,23 @@ export async function executor(

if (error.response) {
const {
status: statusCode,
statusText: errorText,
status,
statusText,
headers: responseHeaders,
data: { message: errorMessage },
data: { message: responseMessage },
} = error.response;
const errorMessageAsSuffix = errorMessage ? `: ${errorMessage}` : '';
const message = `[${statusCode}] ${errorText}${errorMessageAsSuffix}`;
const responseMessageAsSuffix = responseMessage ? `: ${responseMessage}` : '';
const message = `[${status}] ${statusText}${responseMessageAsSuffix}`;
logger.error(`error on ${actionId} webhook event: ${message}`);
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
// special handling for 5xx
if (statusCode >= 500) {
if (status >= 500) {
return retryResult(actionId, message);
}

// special handling for rate limiting
if (statusCode === 429) {
if (status === 429) {
return pipe(
getRetryAfterIntervalFromHeaders(responseHeaders),
map((retry) => retryResultSeconds(actionId, message, retry)),
Expand Down

0 comments on commit bbdea96

Please sign in to comment.