Changelog - 2026-11-03
TypesenseConnector.importDocuments can throw on a partial import
New FeatureIn one line. Pass throwOnFail: true to importDocuments when a rejected row must stop your job; without it nothing changes.
What changed
- A new option,
throwOnFail, defaultfalse. The connector always passesthrowOnFail: falsetotypesense-js, so a rejected row comes back in the result (count.failandresponses) and does not throwImportErrorastypesense-jsdoes by default. That is unchanged. throwOnFail: truethrows after the last batch. Every batch runs first, so the batches that succeeded are written. The error is422, with[importDocuments] N of M documents were rejected by the enginein the message andextra.details={ totalCount, processedCount, successCount, failCount }.- The per-row responses are on
error.responses. They hold the rejected documents and the engine's text, so they are not inextra, which goes on the wire.
Who is affected
- Code that relied on
ImportErrorfromtypesense-js. PassthrowOnFail: trueand readerror.responses, or keep readingcount.fail. - Everyone else. No action needed.
Details
typescript
try {
await connector.importDocuments({ collection: 'products', documents, throwOnFail: true });
} catch (error) {
// 422: error.extra.details has the counts, (error as { responses: unknown[] }).responses every per-row response
}