Error
└── BatchProcessingError
├── FullBatchFailureError
├── SqsFifoShortCircuitError
├── SqsFifoMessageGroupShortCircuitError
├── UnexpectedBatchTypeError
└── ParsingErrorBase error class for all batch processing errors.
class BatchProcessingError extends Error {
constructor(message: string);
name: string;
}Thrown when all records fail processing (unless throwOnFullBatchFailure: false).
class FullBatchFailureError extends BatchProcessingError {
constructor(childErrors: Error[]);
name: string;
recordErrors: Error[];
}Usage:
try {
return await processPartialResponse(event, recordHandler, processor, { context });
} catch (error) {
if (error instanceof FullBatchFailureError) {
console.error(`All ${error.recordErrors.length} records failed`);
}
throw error;
}Disable:
processPartialResponse(event, recordHandler, processor, {
context,
throwOnFullBatchFailure: false,
});Applied to unprocessed records when FIFO processing is short-circuited.
class SqsFifoShortCircuitError extends BatchProcessingError {
constructor();
name: string;
}Applied to records from a failed message group when skipGroupOnError: true.
class SqsFifoMessageGroupShortCircuitError extends BatchProcessingError {
constructor();
name: string;
}Thrown when event doesn't contain a valid Records array.
class UnexpectedBatchTypeError extends BatchProcessingError {
constructor();
name: string;
}Thrown when schema validation fails during parser integration.
class ParsingError extends BatchProcessingError {
constructor(message: string);
name: string;
}Usage:
try {
return await processPartialResponse(event, recordHandler, processor, { context });
} catch (error) {
if (error instanceof ParsingError) {
console.error('Schema validation failed:', error.message);
}
throw error;
}try {
return await processPartialResponse(event, recordHandler, processor, { context });
} catch (error) {
if (error instanceof BatchProcessingError) {
console.error('Batch error:', error.name, error.message);
}
throw error;
}try {
return await processPartialResponse(event, recordHandler, processor, { context });
} catch (error) {
if (error instanceof FullBatchFailureError) {
console.error(`All failed: ${error.recordErrors.length} errors`);
} else if (error instanceof ParsingError) {
console.error('Validation failed:', error.message);
} else if (error instanceof UnexpectedBatchTypeError) {
console.error('Invalid event structure');
}
throw error;
}class ValidationError extends Error {
constructor(message: string) {
super(message);
this.name = 'ValidationError';
}
}
const recordHandler = async (record: SQSRecord): Promise<void> => {
const payload = JSON.parse(record.body);
if (!payload.id) throw new ValidationError('Missing id');
// Process record
};Failed records are tracked in the response:
type PartialItemFailureResponse = {
batchItemFailures: Array<{ itemIdentifier: string }>;
};Item Identifiers: