chore: improve/guard function if invalid paameter is given

This commit is contained in:
rugk
2026-03-25 17:39:20 +00:00
parent a1b54fda25
commit 0de2b52550

View File

@@ -1750,6 +1750,11 @@ window.PrivateBin = (function () {
args = [args.message];
}
// function guard
if (!element) {
throw new TypeError(`invalid/no element (${element}) given for alert type ${alertType[id]} with ID ${id}`);
}
// pass to custom handler if defined
if (typeof customHandler === 'function') {
let handlerResult = customHandler(alertType[id], element, args, icon);