I have an angular app that introduced a negative lookbehind regex and broke compatabiliity with safari 15.6. We want to still support that version and have reverted to using compatible regex that it likes however this question is more about the code that throws the SyntaxError
and how if possible can the I catch the error and then handle appropriately instead of serving the white screen of death.
Known things;
- Non V8 browsers such as Safari don’t support them (lookbehind regex)
- The immediate fix is to downgrade to tolerable regex syntax
- I’ve successfully created the script tags in vanillaJS such that I could attach eventHandlers to each script. However the SyntaxError being thrown doesn’t trigger the errorHandler.0_o
Primary question:
- Is the
SyntaxError
thrown by safari 15.6 in this case catchable? If so from where? - What code is parsing the regex and throwing an error if its not supported?