<commit_before><!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>jupyter-js-output-area</title>
  <script src="../dist/jupyter-js-output-area.js"></script> 
</head>
<body>
  <h1>jupyter-js-output-area</h1>
  <div id='screen'></div>
  
  <script>
  function fetchJSONFile(path) {
      return new Promise(function(resolve, reject) {
          var httpRequest = new XMLHttpRequest();
          httpRequest.onreadystatechange = function() {
              if (httpRequest.readyState === 4) {
                  if (httpRequest.status === 200) {                      
                      resolve(JSON.parse(httpRequest.responseText));
                  } else {
                      reject(Error('httpRequest.status === ' + httpRequest.status));
                  }
              }
          };
          httpRequest.open('GET', path);
          httpRequest.send(); 
      });
  }
  
  fetchJSONFile('./data/data.json').then(function(messages) {
      var model = new jupyterOutputArea.OutputModel();
      var view = new jupyterOutputArea.OutputView(model, document);
      document.getElementById('screen').appendChild(view.el);
      for (var i = 0; i < messages.length; i++) {
          model.consumeMessage(messages[i]);
      }
  }).catch(function(err) {
      console.error('Could not load sample data: ', err);
  });
  </script>

</body>
</html><commit_msg>Fixed error catching in demo<commit_after><!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>jupyter-js-output-area</title>
  <script src="../dist/jupyter-js-output-area.js"></script> 
</head>
<body>
  <h1>jupyter-js-output-area</h1>
  <div id='screen'></div>
  
  <script>
  function fetchJSONFile(path) {
      return new Promise(function(resolve, reject) {
          var httpRequest = new XMLHttpRequest();
          httpRequest.onreadystatechange = function() {
              if (httpRequest.readyState === 4) {
                  if (httpRequest.status === 200) {                      
                      resolve(JSON.parse(httpRequest.responseText));
                  } else {
                      reject(Error('httpRequest.status === ' + httpRequest.status));
                  }
              }
          };
          httpRequest.open('GET', path);
          httpRequest.send(); 
      });
  }
  
  fetchJSONFile('./data/data.json').then(function(messages) {
      var model = new jupyterOutputArea.OutputModel();
      var view = new jupyterOutputArea.OutputView(model, document);
      document.getElementById('screen').appendChild(view.el);
      for (var i = 0; i < messages.length; i++) {
        try {
            model.consumeMessage(messages[i]);
        } catch (error) {
            console.log(error);
        }
      }
  }).catch(function(err) {
      console.error('Could not load sample data: ', err);
  });
  </script>

</body>
</html>
{'fraction_non_alphanumeric': 0.15292879691336372, 'fraction_numerical': 0.0056120659417748155, 'mean_word_length': 2.11353711790393, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6090855', 'n_tokens_mistral': 873, 'n_tokens_neox': 842, 'n_words': 145}