garzj / google-photos-migrate

A tool to fix EXIF data and recover filenames from a Google Photos takeout, preserving albums within the directory structure.
https://npmjs.com/package/google-photos-migrate
MIT License
104 stars 11 forks source link

[Bug] Error message generation of `fullMigrate` is raising an exception #10

Closed mtalexan closed 8 months ago

mtalexan commented 9 months ago

When the fullMigrate command is running, if it encounters an error it tries to generate a message. The generation of that message seems to have a bug that's causing an exception.

In particular I see this when it errors out during the duplicate cleanup/detection.

In the following, /mnt is the root of my Takeout folder.

[...snip...]
Done! Processed 11256 files.
Files migrated: 11150
Files failed: 106
Rewriting all tags from /mnt/Google Photos/PhotosError/original_8785a13f-e6d2-45ce-a096-0c237dad625e_2(1).jpg, to  /mnt/Google Photos/Photos/cleaned-original_8785a13f-e6d2-45ce-a096-0c237dad625e_2(1).jpg
Cannot fix metadata for /mnt/Google Photos/PhotosError/iMarkup_20190704_122554.png.json as .json is an unsupported file type.
Rewriting all tags from /mnt/Google Photos/PhotosError/iMarkup_20190704_122554.png, to  /mnt/Google Photos/Photos/cleaned-iMarkup_20190704_122554.png
Rewriting all tags from /mnt/Google Photos/PhotosError/duplicates-2, to  /mnt/Google Photos/Photos/cleaned-duplicates-2
/app/node_modules/exiftool-vendored/dist/ExifToolTask.js:41
                    error = new Error(errMsg);
                            ^

Error: '/mnt/Google Photos/Photos/cleaned-duplicates-2' already exists - /mnt/Google Photos/PhotosError/duplicates-2/20230224_131215.jpg
    at RewriteAllTagsTask.parser (/app/node_modules/exiftool-vendored/dist/ExifToolTask.js:41:29)
    at RewriteAllTagsTask._Task_resolve (/app/node_modules/batch-cluster/dist/Task.js:146:40)

Node.js v18.13.0
error Command failed with exit code 1.

It appears that it encountered some error, but then the attempt to generate the error message itself has an error:

/app/node_modules/exiftool-vendored/dist/ExifToolTask.js:41
                    error = new Error(errMsg);
                            ^