fixup! Added logging to collections event handlers

This commit is contained in:
Fabien "egg" O'Carroll 2023-09-08 14:35:19 +07:00 committed by Fabien 'egg' O'Carroll
parent ff8a3fbf32
commit c9fff97c75

View File

@ -177,6 +177,7 @@ export class CollectionsService {
logging.info(`PostDeletedEvent received, removing post ${event.id} from all collections`);
try {
await this.removePostFromAllCollections(event.id);
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling PostDeletedEvent'});
}
@ -186,6 +187,7 @@ export class CollectionsService {
logging.info(`PostAddedEvent received, adding post ${event.data.id} to matching collections`);
try {
await this.addPostToMatchingCollections(event.data);
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling PostAddedEvent'});
}
@ -199,6 +201,7 @@ export class CollectionsService {
logging.info(`PostEditedEvent received, updating post ${event.data.id} in matching collections`);
try {
await this.updatePostInMatchingCollections(event.data);
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling PostEditedEvent'});
}
@ -208,6 +211,7 @@ export class CollectionsService {
logging.info(`BulkDestroyEvent received, removing posts ${event.data} from all collections`);
try {
await this.removePostsFromAllCollections(event.data);
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling PostsBulkDestroyedEvent'});
}
@ -217,6 +221,7 @@ export class CollectionsService {
logging.info(`PostsBulkUnpublishedEvent received, updating collection posts ${event.data}`);
try {
await this.updateUnpublishedPosts(event.data);
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling PostsBulkUnpublishedEvent'});
}
@ -226,6 +231,7 @@ export class CollectionsService {
logging.info(`PostsBulkFeaturedEvent received, updating collection posts ${event.data}`);
try {
await this.updateFeaturedPosts(event.data);
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling PostsBulkFeaturedEvent'});
}
@ -235,6 +241,7 @@ export class CollectionsService {
logging.info(`PostsBulkUnfeaturedEvent received, updating collection posts ${event.data}`);
try {
await this.updateFeaturedPosts(event.data);
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling PostsBulkUnfeaturedEvent'});
}
@ -244,6 +251,7 @@ export class CollectionsService {
logging.info(`TagDeletedEvent received for ${event.data.id}, updating all collections`);
try {
await this.updateAllAutomaticCollections();
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling TagDeletedEvent'});
}
@ -253,6 +261,7 @@ export class CollectionsService {
logging.info(`PostsBulkAddTagsEvent received for ${event.data}, updating all collections`);
try {
await this.updateAllAutomaticCollections();
/* c8 ignore next 3 */
} catch (err) {
logging.error({err, message: 'Error handling PostsBulkAddTagsEvent'});
}