session.load() error handling #536
Replies: 2 comments 1 reply
-
I'm aware that the API around exceptions in FastF1 is far from optimal and certainly not consistent. A perfect example for this is that you missed the I don't have any concrete ideas for a consistent solution here. But there are some things that would ideal:
This has been somewhere on the back of my mind, but I never got around to working on it. I'm open to a PR that overhauls the whole exceptions stuff in FastF1 completely. That's probably a bit of work, though. Alternatively, a well-thought-out plan on how to improve the current situation, which (additional) exceptions might be necessary, which base classes to use, ... would already be a good step in the right direction. |
Beta Was this translation helpful? Give feedback.
-
Apart from using
or multiple individual excepts to catch the errors specifically with different error handling, I don't really have a good suggestion. |
Beta Was this translation helpful? Give feedback.
-
I have the following code:
Not critical but I would like to catch specific errors instead of using a wildcard except. Looking through the code the following exceptions are possible:
_api.SessionNotAvailableError
core.NoLapDataError
interface.ErgastError
The former two inherits from
Exception
directly. Thoughts about a nice and concise solution for dealing with all these exception classes?Beta Was this translation helpful? Give feedback.
All reactions