| 357 | * @since 4.0.0 |
| 358 | */ |
| 359 | export class DecodeError extends ReasonError("DecodeError")<{ |
| 360 | readonly request: HttpClientRequest.HttpClientRequest |
| 361 | readonly response: ClientResponse.HttpClientResponse |
| 362 | readonly cause?: unknown |
| 363 | readonly description?: string | undefined |
| 364 | }> { |
| 365 | /** |
| 366 | * Formats the request method and URL for response decoding error messages. |
| 367 | * |
| 368 | * @stability unstable |
| 369 | * @since 4.0.0 |
| 370 | */ |
| 371 | get methodAndUrl() { |
| 372 | return formatMethodAndUrl(this) |
| 373 | } |
| 374 | |
| 375 | /** |
| 376 | * Builds the response decoding error message from the response status, optional description, and request details. |
| 377 | * |
| 378 | * @stability unstable |
| 379 | * @since 4.0.0 |
| 380 | */ |
| 381 | override get message() { |
| 382 | const info = `${this.response.status} ${this.methodAndUrl}` |
| 383 | return formatMessage(formatReason(this._tag), this.description, info) |
| 384 | } |
| 385 | |
| 386 | override toJSON(): unknown { |
| 387 | return reasonToJSON(this, super.toJSON()) |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | /** |
| 392 | * Response error for operations that expected a response body but received an empty body. |
nothing calls this directly
no test coverage detected