better logging for training error