(
error: UpstreamError,
status: ContentfulStatusCode,
timestamp: string,
)
| 295 | } |
| 296 | |
| 297 | function createUpstreamErrorResponse( |
| 298 | error: UpstreamError, |
| 299 | status: ContentfulStatusCode, |
| 300 | timestamp: string, |
| 301 | ): ErrorResponse { |
| 302 | return createErrorResponse( |
| 303 | error, |
| 304 | status, |
| 305 | timestamp, |
| 306 | { |
| 307 | name: error.name, |
| 308 | upstreamStatus: error.upstreamStatus, |
| 309 | upstreamHost: error.requestUrl?.hostname, |
| 310 | upstreamBody: truncateString( |
| 311 | error.responseBody, |
| 312 | MAX_UPSTREAM_BODY_LENGTH, |
| 313 | ), |
| 314 | }, |
| 315 | error.errorCode, |
| 316 | ); |
| 317 | } |
| 318 | |
| 319 | /** |
| 320 | * Remap upstream 4xx statuses that are our operational concern (auth, routing, |
no test coverage detected