From 044bab7e5b9fbc492f9dd4876a3d95020e1ebe23 Mon Sep 17 00:00:00 2001 From: Mochamad Noor Syamsu Date: Wed, 3 Apr 2024 23:25:20 +0700 Subject: [PATCH] fix(http): handle axios error code UNABLE_TO_VERIFY_LEAF_SIGNATURE --- docs/src/pages/guides/probes.md | 1 + src/components/probe/prober/http/request.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/docs/src/pages/guides/probes.md b/docs/src/pages/guides/probes.md index 3ec3380a9..c6f37893c 100644 --- a/docs/src/pages/guides/probes.md +++ b/docs/src/pages/guides/probes.md @@ -332,6 +332,7 @@ To make it easier to troubleshoot HTTP requests, we have mapped low-level errors | 24 | Request / response size mismatch with Content-Length header value | | 25 | Missing HTTP client pool | | 26 | Expected error, exact reason is shown on runtime | +| 27 | Unable to verify the first / leaf certificate | | 99 | Others | | 599 | Connection aborted | diff --git a/src/components/probe/prober/http/request.ts b/src/components/probe/prober/http/request.ts index 75d1d10bd..aadca6a3a 100644 --- a/src/components/probe/prober/http/request.ts +++ b/src/components/probe/prober/http/request.ts @@ -423,6 +423,8 @@ function handleAxiosError( } } +// suppress switch-case complexity since this is dead-simple mapping to error code +// eslint-disable-next-line complexity function getErrorStatusWithExplanation(error: unknown): { status: number description: string @@ -573,6 +575,14 @@ function getErrorStatusWithExplanation(error: unknown): { } } + case 'UNABLE_TO_VERIFY_LEAF_SIGNATURE': { + return { + status: 27, + description: + 'ELEAFSIGNATURE: Unable to verify the first / leaf certificate.', + } + } + default: { if (error instanceof AxiosError) { log.error(