merge: ugly work-around to prevent plugins from breaking timelines (!558)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/558

Approved-by: Leah <kevinlukej@gmail.com>
Approved-by: fEmber <acomputerdog@gmail.com>
This commit is contained in:
dakkar 2024-06-21 14:39:26 +00:00
commit c57931d408

View file

@ -28,10 +28,31 @@ export async function install(plugin: Plugin): Promise<void> {
},
log: (): void => {
},
err: (err): void => {
pluginLogs.value.get(plugin.id).push(`${err}`);
throw err; // install時のtry-catchに反応させる
},
/* dakkar 2024-06-20
passing an `err` triggers an unwanted side-effect inside the
AiScript Interpreter:
- the plugin code throws an exception of any kind (in the
specific case that made us look, it was `note.text.split(...)`
on a note with no text)
- the Interpreter's `handleError` calls `this.abort()` before
calling our `err`
- from that point on, every evaluation of that Interpreter object
returns null
- which, at least inside a noteViewInterruptor, causes all notes
to be replaced with a null
I'm reporting this problem upstream, in the meantime we'll have
to do without error logs
*/
// err: (err): void => {
// pluginLogs.value.get(plugin.id).push(`${err}`);
// throw err; // install時のtry-catchに反応させる
// },
});
initPlugin({ plugin, aiscript });