ynshung / better-yt-shorts

Playback, volume, timestamp controls and more on YouTube Shorts.
GNU General Public License v3.0
240 stars 43 forks source link

Exception catching for failure in selecting elements #185

Closed ynshung closed 9 months ago

ynshung commented 10 months ago

There have been two instances of failure in element selection (#178, #183) where problems outlined in #184 occurred every time. To avoid any future instances, there should be an exception catching in one of the stages (preferably catch-all and not individually in each selector) but if there's any better idea feel free to throw them around

Expected behavior: When one of the injection fails (progress bar/autoplay/etc.), it should not affect other components or the extension onthe whole.

adsuth commented 10 months ago

definitely overdesigning this, but i think this could do with a robust plan.

Current thoughts would be to, instead of storing the id of shorts that successfully injected, we could create an InjectionState object that stores the whether each element succeeded, failed, etc.

So for example of what that could entail:

InjectionState:

InjectionStateUnit:

These state objects are then added to the set instead; checking for injection is as simple as checking if fullInjectionComplete is true, if not, try inject all FAILED elements again.

When an element fails injection, show a toaster menu to user saying that it failed. Clicking it could link to this issues page

for error handling, we'd wrap callback in a try catch. The catch displays the toaster, and sets the state to failed

not sure of the feasibility mind you, but i'll look into it later on. I'm in a painfully java mind at the moment

ynshung commented 9 months ago

Implemented on #195