UNPKG

event-driven

Version:

makes building event-driven-architecture easy

17 lines (16 loc) 679 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createBatchError = exports.BatchError = void 0; const mongoose_1 = require("mongoose"); const BatchErrorSchema = new mongoose_1.Schema({}, { timestamps: true, strict: false }); exports.BatchError = mongoose_1.model('BatchError', BatchErrorSchema); const createBatchError = (batchId) => (error) => { new exports.BatchError({ batchId, message: error.message ? JSON.stringify(error.message) : undefined, stack: error.stack ? JSON.stringify(error.stack) : undefined, isConfirmed: false, }).save(); return; }; exports.createBatchError = createBatchError;