| 278 | * @since 4.0.0 |
| 279 | */ |
| 280 | export class InvalidUrlError extends ReasonError("InvalidUrlError")<{ |
| 281 | readonly request: HttpClientRequest.HttpClientRequest |
| 282 | readonly cause?: unknown |
| 283 | readonly description?: string |
| 284 | }> { |
| 285 | /** |
| 286 | * Formats the request method and URL for invalid URL error messages. |
| 287 | * |
| 288 | * @stability unstable |
| 289 | * @since 4.0.0 |
| 290 | */ |
| 291 | get methodAndUrl() { |
| 292 | return formatMethodAndUrl(this) |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * Builds the invalid URL error message from the optional description and request details. |
| 297 | * |
| 298 | * @stability unstable |
| 299 | * @since 4.0.0 |
| 300 | */ |
| 301 | override get message() { |
| 302 | return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl) |
| 303 | } |
| 304 | |
| 305 | override toJSON(): unknown { |
| 306 | // The cause holds the URL as sent, which may include a redacted path param. |
| 307 | const { cause: _, ...rest } = reasonToJSON(this, super.toJSON()) as Record<string, unknown> |
| 308 | return rest |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | /** |
| 313 | * Response error for HTTP responses rejected because of their status code. |
nothing calls this directly
no test coverage detected