It would be better to use multiple exception blocks:
```
except AIGradingInternalError:
   logger.exception("..")
    raise
except AITrainingInternalError:
   logger.exception("..")
   raise
```

That way, unexpected errors won't get caught and mis-interpreted as `AITrainingInternalErrors`