Commit 54dabe4c authored by build-pipeline's avatar build-pipeline
Browse files

publish: feat(dacc): add better error handling

generated from commit a02a8b88
parent 0fb28f4b
...@@ -143,7 +143,9 @@ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoader ...@@ -143,7 +143,9 @@ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoader
const log = _cozyLogger.default.namespace('aggregatorUsageEvents'); const log = _cozyLogger.default.namespace('aggregatorUsageEvents');
   
// Store all id of events read during the process // Store all id of events read during the process
const readUsageEvents = []; const readUsageEvents = []; // Store error events
const errorEvent = [];
   
const sendIndicator = async (indicator, client) => { const sendIndicator = async (indicator, client) => {
try { try {
...@@ -973,6 +975,17 @@ const AggregatorUsageEvents = async ({ ...@@ -973,6 +975,17 @@ const AggregatorUsageEvents = async ({
const uniqueReadUsageEvents = (0, _lodash.uniq)(readUsageEvents); const uniqueReadUsageEvents = (0, _lodash.uniq)(readUsageEvents);
log('info', `Tag aggregated usage: total of ${uniqueReadUsageEvents.length} events`); log('info', `Tag aggregated usage: total of ${uniqueReadUsageEvents.length} events`);
await _usageEvent.default.updateUsageEventsAggregated(client, uniqueReadUsageEvents); await _usageEvent.default.updateUsageEventsAggregated(client, uniqueReadUsageEvents);
if (errorEvent.length > 0) {
// Build error
let error = `Process end with ${errorEvent.length} errors : `;
errorEvent.forEach(el => {
error += `${el.doctype}, `;
});
log('error', error);
throw error;
}
log('info', 'End of service'); log('info', 'End of service');
}; };
   
...@@ -988,6 +1001,7 @@ const AggregatorUsageEvents = async ({ ...@@ -988,6 +1001,7 @@ const AggregatorUsageEvents = async ({
   
reactHotLoader.register(log, "log", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts"); reactHotLoader.register(log, "log", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts");
reactHotLoader.register(readUsageEvents, "readUsageEvents", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts"); reactHotLoader.register(readUsageEvents, "readUsageEvents", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts");
reactHotLoader.register(errorEvent, "errorEvent", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts");
reactHotLoader.register(sendIndicator, "sendIndicator", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts"); reactHotLoader.register(sendIndicator, "sendIndicator", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts");
reactHotLoader.register(reduceEvents, "reduceEvents", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts"); reactHotLoader.register(reduceEvents, "reduceEvents", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts");
reactHotLoader.register(sendAggregatedEventByDay, "sendAggregatedEventByDay", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts"); reactHotLoader.register(sendAggregatedEventByDay, "sendAggregatedEventByDay", "/builds/web-et-numerique/llle_project/ecolyo/src/targets/services/aggregatorUsageEvents.ts");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment