AprilSylph / XKit-Rewritten

🧰 The enhancement suite for Tumblr's new web interface
GNU General Public License v3.0
274 stars 44 forks source link

Mutations util: Isolate callback errors via async function #1509

Open marcustyphoon opened 1 week ago

marcustyphoon commented 1 week ago

Description

One weird way to address #1508, rather than the eminently reasonable "two try-catches with console.log(error) in the catch block", is to run the relevant code in an async forEach. This means exceptions become rejected promises in the console and don't affect other loop iterations.

This also means that there is an async keyword which serves a purpose despite having no corresponding await, which is pretty terrible practice (I try to remove those!), especially uncommented.

Testing steps