Add logging if file size does not match

make-only-subtitle-default
HaveAGitGat 2 years ago
parent d949b203e5
commit 949e4cfa9a

@ -117,6 +117,10 @@ var moveFileAndValidate = function (_a) {
return [3 /*break*/, 6]; return [3 /*break*/, 6];
case 6: case 6:
if (!(!res1 || inputSize !== outputSize)) return [3 /*break*/, 9]; if (!(!res1 || inputSize !== outputSize)) return [3 /*break*/, 9];
if (inputSize !== outputSize) {
args.jobLog("File sizes do not match, input: ".concat(inputSize, " ")
+ "does not equal output: ".concat(outputSize));
}
args.jobLog("Attempt 1 failed: Moving file from ".concat(inputPath, " to ").concat(outputPath)); args.jobLog("Attempt 1 failed: Moving file from ".concat(inputPath, " to ").concat(outputPath));
args.jobLog("Attempt 2: Moving file from ".concat(inputPath, " to ").concat(outputPath)); args.jobLog("Attempt 2: Moving file from ".concat(inputPath, " to ").concat(outputPath));
return [4 /*yield*/, new Promise(function (resolve) { return [4 /*yield*/, new Promise(function (resolve) {
@ -135,6 +139,10 @@ var moveFileAndValidate = function (_a) {
case 8: case 8:
outputSize = _b.sent(); outputSize = _b.sent();
if (!res2 || inputSize !== outputSize) { if (!res2 || inputSize !== outputSize) {
if (inputSize !== outputSize) {
args.jobLog("File sizes do not match, input: ".concat(inputSize, " ")
+ "does not equal output: ".concat(outputSize));
}
errMessage = "Failed to move file from ".concat(inputPath, " to ").concat(outputPath, ", check errors above"); errMessage = "Failed to move file from ".concat(inputPath, " to ").concat(outputPath, ", check errors above");
args.jobLog(errMessage); args.jobLog(errMessage);
throw new Error(errMessage); throw new Error(errMessage);

@ -75,6 +75,11 @@ export const moveFileAndValidate = async ({
} }
if (!res1 || inputSize !== outputSize) { if (!res1 || inputSize !== outputSize) {
if (inputSize !== outputSize) {
args.jobLog(`File sizes do not match, input: ${inputSize} `
+ `does not equal output: ${outputSize}`);
}
args.jobLog(`Attempt 1 failed: Moving file from ${inputPath} to ${outputPath}`); args.jobLog(`Attempt 1 failed: Moving file from ${inputPath} to ${outputPath}`);
args.jobLog(`Attempt 2: Moving file from ${inputPath} to ${outputPath}`); args.jobLog(`Attempt 2: Moving file from ${inputPath} to ${outputPath}`);
@ -92,6 +97,11 @@ export const moveFileAndValidate = async ({
outputSize = await getFileSize(outputPath); outputSize = await getFileSize(outputPath);
if (!res2 || inputSize !== outputSize) { if (!res2 || inputSize !== outputSize) {
if (inputSize !== outputSize) {
args.jobLog(`File sizes do not match, input: ${inputSize} `
+ `does not equal output: ${outputSize}`);
}
const errMessage = `Failed to move file from ${inputPath} to ${outputPath}, check errors above`; const errMessage = `Failed to move file from ${inputPath} to ${outputPath}, check errors above`;
args.jobLog(errMessage); args.jobLog(errMessage);
throw new Error(errMessage); throw new Error(errMessage);

Loading…
Cancel
Save