Add try catch to heic conversion.
This commit is contained in:
@@ -27,7 +27,7 @@ export async function ConvertHeicFiles(files: Express.Multer.File[]) {
|
||||
const convertedFileName = `${
|
||||
path.parse(path.basename(file.originalname)).name
|
||||
}-${Math.floor(Date.now() / 1000)}.jpeg`;
|
||||
|
||||
try {
|
||||
await ConvertToJpeg(
|
||||
file.path,
|
||||
`${file.destination}/${convertedFileName}`
|
||||
@@ -52,6 +52,14 @@ export async function ConvertHeicFiles(files: Express.Multer.File[]) {
|
||||
file.filename = convertedFileName;
|
||||
file.mimetype = "image/jpeg";
|
||||
file.path = `${file.destination}/${convertedFileName}`;
|
||||
} catch (error) {
|
||||
logger.log(
|
||||
"error",
|
||||
`Error converting ${
|
||||
file.filename
|
||||
} image to JPEG from HEIC. ${JSON.stringify(error)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user