mirror of
https://github.com/standardnotes/server
synced 2026-10-14 03:13:45 -04:00
fix: log errors on not being able to create a backup file
This commit is contained in:
@@ -72,6 +72,7 @@ describe('EmailBackupRequestedEventHandler', () => {
|
||||
logger = {} as jest.Mocked<Logger>
|
||||
logger.debug = jest.fn()
|
||||
logger.warn = jest.fn()
|
||||
logger.error = jest.fn()
|
||||
})
|
||||
|
||||
it('should inform that backup attachment for email was created', async () => {
|
||||
|
||||
@@ -63,18 +63,22 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
|
||||
|
||||
this.logger.debug(`Data backed up into: ${backupFileName}`)
|
||||
|
||||
if (backupFileName.length !== 0) {
|
||||
this.logger.debug('Publishing EMAIL_BACKUP_ATTACHMENT_CREATED event')
|
||||
if (backupFileName.length === 0) {
|
||||
this.logger.error(`Could not create a backup file for user ${event.payload.userUuid}`)
|
||||
|
||||
await this.domainEventPublisher.publish(
|
||||
this.domainEventFactory.createEmailBackupAttachmentCreatedEvent({
|
||||
backupFileName,
|
||||
backupFileIndex: bundleIndex++,
|
||||
backupFilesTotal: itemUuidBundles.length,
|
||||
email: authParams.identifier as string,
|
||||
}),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
this.logger.debug('Publishing EMAIL_BACKUP_ATTACHMENT_CREATED event')
|
||||
|
||||
await this.domainEventPublisher.publish(
|
||||
this.domainEventFactory.createEmailBackupAttachmentCreatedEvent({
|
||||
backupFileName,
|
||||
backupFileIndex: bundleIndex++,
|
||||
backupFilesTotal: itemUuidBundles.length,
|
||||
email: authParams.identifier as string,
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user