API View source
TranslateBatchPolicyError
Error raised when translateBatch() policy configuration chooses fail-fast handling for a structured translation anomaly.
Signature
class TranslateBatchPolicyError<TInput = unknown> extends ErrorThis exported error class is raised when translateBatch() policy configuration chooses fail-fast handling for a structured translation anomaly.
Usage
import { TranslateBatchPolicyError, translateBatch } from "causal-order/translate"
try {
translateBatch(records, {
getEventId: (record) => record.eventId,
getNodeId: (record) => record.nodeId,
getPhysicalTime: (record) => record.occurredAt,
policy: {
recordFailure: "fail",
optionalFieldFailure: "warn",
},
})
} catch (error) {
if (error instanceof TranslateBatchPolicyError) {
console.error(error.anomaly)
}
} Details
- Extends
Errorand carries the triggering structuredanomaly. - Raised only when the configured translation policy chooses
failfor the encountered anomaly class. - Available from both
causal-orderand the narrowercausal-order/translateentrypoint.