// TODO: Add Error(Exception) override function to Task to support better error handling public override void Execute() { ItemScore itemScore = null; // Step 1: Score the Item try { // Note: This is sync but it is OK since it is executed by 1 of the thread pool threads so it is async to the original caller itemScore = scorerImpl.ScoreItem(studentResponse, null); } catch (Exception ex) { // Exception scoring item. Prepare an error report itemScore = new ItemScore(-1, -1, ScoringStatus.ScoringError, null, new ScoreRationale() { Msg = "Exception scoring item " + studentResponse.ItemIdentifier + "\n" + ex.Message, Exception = ex }, null, studentResponse.ContextToken); } // Step 2: Use the callback to report the score try { callback.ScoreAvailable(itemScore, studentResponse); } catch (Exception ex) { TDSLogger.Application.Error(new TraceLog("Item Scoring: Exception Reporting Score", ex)); } }
public ItemScoreResponse(ItemScore itemScore, string contextToken) { Score = itemScore; Score.ContextToken = contextToken; }
public ItemScoreResponse(ItemScore itemScore) { Score = itemScore; }