Skip to content

Commit

Permalink
fix(http): handle axios error code UNABLE_TO_VERIFY_LEAF_SIGNATURE
Browse files Browse the repository at this point in the history
  • Loading branch information
syamsudotdev committed Apr 3, 2024
1 parent 1eb87eb commit 044bab7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/pages/guides/probes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Expand Down
10 changes: 10 additions & 0 deletions src/components/probe/prober/http/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 044bab7

Please sign in to comment.