Base classes do not know about derived classes. Its the other way around.
In general you cannot know from the type of an exception what the correct way to handle it is.
Assuming that the app (service) has past its tests the you will want to do:
Log the full stack trace
Restart the service
Add code to be explicitly handle the exception and recover appropiately.
I use the OS service manager to deal with the (2) restart issue.
In my case that is either app specific logic to fork off a new worker, or use systemd .service unit to express restart behaviour, detect fast restarts etc
You don’t need to instantiate the exception class, because you have already been passed the instance that was raised.
If your hook function is defined like this:
def myexceptionhook(ex_type, ex_inst, tb):
...
then you can decide what to do by inspecting any of those three arguments. For example:
if issubclass(ex_type, OSError):
# do whatever is appropriate for an OSError
Note that OSError is usually raised from file operations that failed, e.g. file not found, insufficient permissions to open a file, attempting to write to a file on read-only media, etc.