<commit_before>import { warningNotification } from "../actions/notifications";
import { charonAPIAddress } from "./globals";
import { NEW_NARRATIVE } from "../actions/types";

// eslint-disable-next-line
export const getNarrative = (dispatch, datasetPathName) => {
  const errorHandler = (e) => {
    this.props.dispatch(warningNotification({message: "Failed to get narrative from server"}));
    console.error(e);
  };
  const xmlHttp = new XMLHttpRequest();
  xmlHttp.onload = () => {
    if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
      dispatch({
        type: NEW_NARRATIVE,
        blocks: JSON.parse(xmlHttp.responseText)
      });<commit_msg>fix bug in getNarrative 404 handling<commit_after>import { warningNotification } from "../actions/notifications";
import { charonAPIAddress } from "./globals";
import { NEW_NARRATIVE } from "../actions/types";

// eslint-disable-next-line
export const getNarrative = (dispatch, datasetPathName) => {
  const errorHandler = (e) => {
    // dispatch(warningNotification({message: "Failed to get narrative from server"}));
    console.error("Failed to get narrative from server");
    console.error(e);
  };
  const xmlHttp = new XMLHttpRequest();
  xmlHttp.onload = () => {
    if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
      dispatch({
        type: NEW_NARRATIVE,
        blocks: JSON.parse(xmlHttp.responseText)
      });
{'fraction_non_alphanumeric': 0.14682822523164646, 'fraction_numerical': 0.007840342124019958, 'mean_word_length': 3.7432432432432434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '1747081', 'n_tokens_mistral': 424, 'n_tokens_neox': 408, 'n_words': 99}