Skip to content

Commit

Permalink
Fix the issue that the error "SyntaxError: Unexpected end of JSON inp…
Browse files Browse the repository at this point in the history
…ut" is published and thumbnail generation does not continue to run.
  • Loading branch information
TomoyukiAota committed Dec 9, 2024
1 parent 7608141 commit 68b9be3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src-shared/thumbnail/cache/thumbnail-cache-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,14 @@ export function lastModifiedMatchBetweenSrcFileAndThumbnailGenerationLogFile(src
return false;
}

const fileContentObj = JSON.parse(fileContentStr);
let fileContentObj;
try {
fileContentObj = JSON.parse(fileContentStr);
} catch (error) {
Logger.error(`Failed to parse the content of the log file "${logFilePath}" as JSON format. The log file is for thumbnail generation result of "${srcFilePath}". error: ${error}`, error);
return false;
}

const lastModifiedFromLogFile = fileContentObj[lastModifiedKey];
if (!lastModifiedFromLogFile)
return false;
Expand Down

0 comments on commit 68b9be3

Please sign in to comment.