| 396 | * @since 4.0.0 |
| 397 | */ |
| 398 | export class EmptyBodyError extends ReasonError("EmptyBodyError")<{ |
| 399 | readonly request: HttpClientRequest.HttpClientRequest |
| 400 | readonly response: ClientResponse.HttpClientResponse |
| 401 | readonly cause?: unknown |
| 402 | readonly description?: string | undefined |
| 403 | }> { |
| 404 | /** |
| 405 | * Formats the request method and URL for empty response body error messages. |
| 406 | * |
| 407 | * @stability unstable |
| 408 | * @since 4.0.0 |
| 409 | */ |
| 410 | get methodAndUrl() { |
| 411 | return formatMethodAndUrl(this) |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Builds the empty body error message from the response status, optional description, and request details. |
| 416 | * |
| 417 | * @stability unstable |
| 418 | * @since 4.0.0 |
| 419 | */ |
| 420 | override get message() { |
| 421 | const info = `${this.response.status} ${this.methodAndUrl}` |
| 422 | return formatMessage(formatReason(this._tag), this.description, info) |
| 423 | } |
| 424 | |
| 425 | override toJSON(): unknown { |
| 426 | return reasonToJSON(this, super.toJSON()) |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | /** |
| 431 | * Union of HTTP client errors that occur before a response is available. |
nothing calls this directly
no test coverage detected