mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-04-18 21:48:24 -04:00
chore: improve/guard function if invalid paameter is given
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user