The client uses typed errors. Catch these errors at the application boundary.
The client throws SolrHttpError when Solr returns a non-success HTTP status.
| Property | Description |
|---|---|
status |
HTTP status code. |
statusText |
HTTP status text. |
endpoint |
Request origin and path. The query string is omitted. |
body |
Raw response body as text. An empty response is an empty string. |
payload |
Parsed JSON, raw text when JSON parsing fails, or undefined for an empty body. |
solrError |
Normalized Solr error detail with code, msg, and metadata when present. |
errorResponse |
Typed raw Solr error payload (SolrErrorResponse) when the response contains an error field. |
cause |
Optional underlying error, when one exists. |
The solrError object preserves Solr fields such as code, msg, and metadata. The errorResponse property preserves the typed response envelope, including string-form errors. The error message uses solrError.msg when it is available. Otherwise, it uses the HTTP status and status text.
The client does not add request headers or configured Basic/Bearer credentials to error properties. The endpoint omits query parameters. However, body and payload are server-controlled response data and may contain echoed input; sanitize them before logging. Network error cause values may also originate from a custom Fetch implementation, so apply the same care when logging causes.
The client throws SolrNetworkError when Fetch fails before a response is received, or when reading a non-streaming response body fails.
endpointcontains the request origin and path without query parameters.causecontains the original Fetch or body-read error.
The transport can retry configured network failures. When the retry policy is exhausted, the final error is SolrNetworkError.
The client throws SolrTimeoutError when the configured client or per-request timeout expires. It includes the endpoint and timeout duration in milliseconds.
The client throws SolrAbortError when the caller's AbortSignal cancels the request. It includes the endpoint and the caller's abort reason.
Timeout and caller cancellation use different error classes. Do not treat a caller cancellation as a retryable network failure.
The client throws SolrValidationError when an enabled input or output schema rejects a value. The error includes the operation name and validation issues.
- Valid JSON is available in
payloadas a parsed value. - Text and malformed JSON remain available as text in
bodyandpayload. - Empty response bodies produce
body === ""andpayload === undefined. - HTTP errors are raised for both JSON and non-JSON response bodies.
The export() method returns the raw Fetch API Response for successful responses. Read its body as a stream. For a non-success response, it throws SolrHttpError with the raw body and parsed payload.