♻️Removed console.log from backend node + error serializer

This commit is contained in:
Anton SHEPILOV
2024-11-01 11:51:06 +01:00
committed by Anton Shepilov
parent 01744274eb
commit da9736e23b
19 changed files with 121 additions and 139 deletions
@@ -1,6 +1,9 @@
import { fromPath } from "pdf2pic";
import { mkdirSync } from "fs";
import { cleanFiles, getTmpFile } from "../../../../../utils/files";
import { logger } from "../../../../../core/platform/framework";
class PDFConversionError extends Error {}
export async function convertFromPdf(
inputPath: string,
@@ -33,11 +36,12 @@ export async function convertFromPdf(
//Just no more page to convert
}
} catch (error) {
console.error(error);
const pdfConversionError = new PDFConversionError("Can't convert file with pdf-image.", { cause: error });
logger.error(pdfConversionError);
for (const file of pages) {
cleanFiles([file]);
}
throw Error("Can't convert file with pdf-image.");
throw pdfConversionError;
}
return { output: pages, done: true };
}