I’m building a python library that implements a task queue. If for whatever reason the thread that processes the tasks dies, and the option to restart the thread isn’t set, I need to throw an exception.
Is this something that I should just throw a RuntimeException for? I don’t want to throw a custom exception since they’d have to import that, but I’m not sure how throw exceptions to arbitrary calling code is best implemented.
Throw a custom exception. If the user of the library needs to catch that exception, they can import it.
For instance, take
pickle.PicklingError: