google-photos-migrate
Version:
A tool to fix EXIF data and recover filenames from a Google Photos takeout.
44 lines (43 loc) • 1.36 kB
JavaScript
import { MediaMigrationError } from '../media/MediaMigrationError.js';
export class ApplyMetaError extends MediaMigrationError {
constructor(failedMedia) {
super(failedMedia);
}
toString() {
return `Failed to apply meta tags on file: ${this.failedMedia.path}`;
}
}
export class ExifToolError extends ApplyMetaError {
reason;
constructor(failedMedia, reason) {
super(failedMedia);
this.reason = reason;
}
toString() {
return (`ExifTool failed to modify file: ${this.failedMedia.path}` +
`\nReason: ${this.reason.message}`);
}
}
export class WrongExtensionError extends ApplyMetaError {
currentExt;
actualExt;
constructor(failedMedia, currentExt, actualExt) {
super(failedMedia);
this.currentExt = currentExt;
this.actualExt = actualExt;
}
toString() {
return `File has wrong file extension ${this.actualExt}, should be ${this.currentExt}: ${this.failedMedia.path}`;
}
}
export class MissingMetaError extends ApplyMetaError {
keyName;
constructor(failedMedia, keyName) {
super(failedMedia);
this.keyName = keyName;
}
toString() {
return (`Missing key ${this.keyName} from meta file: ${this.failedMedia.jsonPath}` +
`\nOriginal file: ${this.failedMedia.path}`);
}
}