throw errors in utils and helpers

This commit is contained in:
Viet Huynh
2023-11-19 17:48:37 +07:00
parent 70a2dfa89f
commit b364df7864
3 changed files with 8 additions and 0 deletions
+1
View File
@@ -38,6 +38,7 @@ const downloadLists = async (filename, urls) => {
} catch (err) {
console.error(`An error occurred while processing ${filename}:\n`, err);
console.error("URLs:\n", urls);
throw err;
}
};
+6
View File
@@ -51,6 +51,7 @@ export const createZeroTrustListsOneByOne = async (items) => {
console.log(`Created "${listName}" list - ${totalListNumber} left`);
} catch (err) {
console.error(`Could not create "${listName}" - ${err.toString()}`);
throw err;
}
}
};
@@ -77,6 +78,7 @@ export const createZeroTrustListsAtOnce = async (items) => {
console.log("Created lists successfully");
} catch (err) {
console.error(`Error occurred while creating lists - ${err.toString()}`);
throw err;
}
};
@@ -106,6 +108,7 @@ export const deleteZeroTrustListsOneByOne = async (lists) => {
console.log(`Deleted ${name} list - ${totalListNumber} left`);
} catch (err) {
console.error(`Could not delete ${name} - ${err.toString()}`);
throw err;
}
}
};
@@ -124,6 +127,7 @@ export const deleteZeroTrustListsAtOnce = async (lists) => {
console.log("Deleted lists successfully");
} catch (err) {
console.error(`Error occurred while deleting lists - ${err.toString()}`);
throw err;
}
};
@@ -161,6 +165,7 @@ export const createZeroTrustRule = async (wirefilterExpression) => {
console.log("Created rule successfully");
} catch (err) {
console.error(`Error occurred while creating rule - ${err.toString()}`);
throw err;
}
};
@@ -180,5 +185,6 @@ export const deleteZeroTrustRule = async (id) => {
console.log("Deleted rule successfully");
} catch (err) {
console.error(`Error occurred while deleting rule - ${err.toString()}`);
throw err;
}
};
+1
View File
@@ -87,5 +87,6 @@ export const readFile = async (filePath, onLine) => {
console.error(
`Error occurred while reading ${basename(filePath)} - ${err.toString()}`
);
throw err;
}
};