update trycatch runtime

This commit is contained in:
joseph le 2023-10-13 13:12:49 +07:00
parent 411f135a70
commit 4696f155c4
1 changed files with 242 additions and 238 deletions

View File

@ -99,6 +99,7 @@ export async function runtimeCheckLogs(folderPath) {
// Watch for changes in the files listed // Watch for changes in the files listed
async function watchFilesInList() { async function watchFilesInList() {
try {
//only check new file ---> fileList - fileList_old = new file //only check new file ---> fileList - fileList_old = new file
let listFileWatch = fileList let listFileWatch = fileList
?.filter((i) => fileList_old.includes(i) === false) ?.filter((i) => fileList_old.includes(i) === false)
@ -210,7 +211,8 @@ export async function runtimeCheckLogs(folderPath) {
if ( if (
checkSpecialVersion(line) !== "" && checkSpecialVersion(line) !== "" &&
listExcludeErr.filter((err) => line.includes(err)).length === 0 listExcludeErr.filter((err) => line.includes(err)).length ===
0
) { ) {
let checkVersion = checkSpecialVersion(line); let checkVersion = checkSpecialVersion(line);
let log = allFile?.filter( let log = allFile?.filter(
@ -244,8 +246,8 @@ export async function runtimeCheckLogs(folderPath) {
// console.log({line:Array(line), value:Array(value)}) // console.log({line:Array(line), value:Array(value)})
if ( if (
line.includes(value) && line.includes(value) &&
listExcludeErr.filter((err) => line.includes(err)).length === listExcludeErr.filter((err) => line.includes(err))
0 .length === 0
) { ) {
let log = allFile?.filter( let log = allFile?.filter(
(i) => i.$original.file_name === fileName (i) => i.$original.file_name === fileName
@ -405,7 +407,6 @@ export async function runtimeCheckLogs(folderPath) {
); );
} }
}, 3000); }, 3000);
// console.log(path + " change")
}); });
watcher.on("error", (error) => { watcher.on("error", (error) => {
@ -418,6 +419,9 @@ export async function runtimeCheckLogs(folderPath) {
// const filePath = `${folderPath}/${fileName}`; // const filePath = `${folderPath}/${fileName}`;
// }); // });
} catch (error) {
console.log(error);
}
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);