enhance(frontend): improve aiscript plugin error handling
This commit is contained in:
parent
f72228f428
commit
bfca457510
5 changed files with 35 additions and 13 deletions
|
@ -202,11 +202,17 @@ let note = $ref(deepClone(props.note));
|
|||
// plugin
|
||||
if (noteViewInterruptors.length > 0) {
|
||||
onMounted(async () => {
|
||||
let result:Misskey.entities.Note | null = deepClone(note);
|
||||
let result: Misskey.entities.Note | null = deepClone(note);
|
||||
for (const interruptor of noteViewInterruptors) {
|
||||
result = await interruptor.handler(result);
|
||||
|
||||
if (result === null) return isDeleted.value = true;
|
||||
try {
|
||||
result = await interruptor.handler(result);
|
||||
if (result === null) {
|
||||
isDeleted.value = true;
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
note = result;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue