Add error handler to filter closure executor

This commit is contained in:
Cohee 2024-12-13 01:23:13 +02:00
parent 294b15976c
commit 6f4350b3a7

View File

@ -91,10 +91,15 @@ const getSlashCommandsHelp = parser.getHelpString.bind(parser);
*/
function closureToFilter(closure) {
return async () => {
const localClosure = closure.getCopy();
localClosure.onProgress = () => { };
const result = await localClosure.execute();
return isTrueBoolean(result.pipe);
try {
const localClosure = closure.getCopy();
localClosure.onProgress = () => { };
const result = await localClosure.execute();
return isTrueBoolean(result.pipe);
} catch (e) {
console.error('Error executing filter closure', e);
return false;
}
};
}