function _tryLoadHistory()

in src/persistence/load.ts [33:54]


function _tryLoadHistory(notebookModel: INotebookModel, gatherModel: GatherModel) {
  let historyCells = notebookModel.metadata.get(EXECUTION_HISTORY_METADATA_KEY);
  if (!JSONExt.isArray(historyCells)) {
    log("Unexpected history metadata format: no array found");
    return;
  }

  let executionsArray = historyCells as JSONArray;
  for (let executionValue of executionsArray) {
    if (!JSONExt.isObject(executionValue)) {
      log("Unexpected history metadata format: cell execution is not an object");
      return;
    }
    let executionJsonObject = executionValue as JSONObject;
    let cellExecution = _loadExecutionFromJson(executionJsonObject);
    if (cellExecution == null) {
      log("Unexpected cell execution format. Loading history aborted.");
      return;
    }
    gatherModel.executionLog.addExecutionToLog(cellExecution);
  }
}