improve error logging

This commit is contained in:
Abhinav 2023-03-02 13:23:19 +05:30
parent 84a2a00c61
commit 60fcf46c63

View file

@ -241,6 +241,7 @@ class ExportService {
RecordType.SUCCESS RecordType.SUCCESS
); );
} catch (e) { } catch (e) {
logError(e, 'export failed for a file');
if ( if (
e.message === e.message ===
CustomError.ADD_FILE_EXPORTED_RECORD_FAILED CustomError.ADD_FILE_EXPORTED_RECORD_FAILED
@ -252,11 +253,6 @@ class ExportService {
file, file,
RecordType.FAILED RecordType.FAILED
); );
logError(
e,
'download and save failed for file during export'
);
} }
this.electronAPIs.showOnTray({ this.electronAPIs.showOnTray({
export_progress: `${index + 1} / ${ export_progress: `${index + 1} / ${
@ -446,6 +442,7 @@ class ExportService {
} }
async downloadAndSave(file: EnteFile, collectionPath: string) { async downloadAndSave(file: EnteFile, collectionPath: string) {
try {
file.metadata = mergeMetadata([file])[0].metadata; file.metadata = mergeMetadata([file])[0].metadata;
const fileSaveName = getUniqueFileSaveName( const fileSaveName = getUniqueFileSaveName(
collectionPath, collectionPath,
@ -474,9 +471,17 @@ class ExportService {
if (file.metadata.fileType === FILE_TYPE.LIVE_PHOTO) { if (file.metadata.fileType === FILE_TYPE.LIVE_PHOTO) {
await this.exportMotionPhoto(fileStream, file, collectionPath); await this.exportMotionPhoto(fileStream, file, collectionPath);
} else { } else {
await this.saveMediaFile(collectionPath, fileSaveName, fileStream); await this.saveMediaFile(
collectionPath,
fileSaveName,
fileStream
);
await this.saveMetadataFile(collectionPath, fileSaveName, file); await this.saveMetadataFile(collectionPath, fileSaveName, file);
} }
} catch (e) {
logError(e, 'download and save failed');
throw e;
}
} }
private async exportMotionPhoto( private async exportMotionPhoto(