mirror of
https://github.com/Nezumi-2711/cloudflare-gateway-pihole-scripts.git
synced 2026-09-22 05:31:50 +00:00
throw errors in utils and helpers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -87,5 +87,6 @@ export const readFile = async (filePath, onLine) => {
|
||||
console.error(
|
||||
`Error occurred while reading ${basename(filePath)} - ${err.toString()}`
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user