I have a tampermonkey script with a @require annotation for a library that provides me with certain tools for the script to work in a specific manner.
However, there are times in which this library is not available (it falls behind a login, so if no session is found, the @require returns a plain html with "unauthorized" explanation).
My objective would be to be able to capture if the resource is successfully loaded, and if it isn't provide with a handled error, which I'm not unable to do - I'm just getting the browser complaint about receiving a < symbol unexpectedly (because of the plain html resulting of the @require).
Do you have any ideas of how to tackle this problem? I've checked Tampermonkey documentation, but to no avail.
Thanks in advance