analyzeTrainingFailure

Recognizes an exception thrown while executing a leaf prompt or inside an optimizer's own training-stage block. Only reached for exceptions that are neither an abort nor an already-analyzed wrapper (those are resolved before this is called).