Ensure that only subclasses of BaseException can be raised