[Feature] Improve exceptions handling
First of all, let's make it very clear: the way I use playwright isn't the intended one, but I still think it would be useful for others.
Right now, Playwright will raise two types of exceptions: Error and TimeoutError (which is a subclass of Error). But in practice, many different types of exceptions are raised, and they are all pretty nicely described in the message field. The issue I have is that it is hard to programmatically figure out what went wrong during the run because this message is multi-line and somewhat free text.
I did some pretty dirty error parsing and try to keep the (relevant part) of the first line of the message as an error name I can handle down the line, depending on what wrong and what I consider being a recoverable error and re-run the capture accordingly.
What I would love is either more exceptions types, or what I use as a name being accessible from the exception class directly, in a similar way I implemented it, minus parsing and splitting the first line of the message.