<commit_before>import {
  compose as composeWithoutDevTools,
  createStore,
  applyMiddleware,
} from 'redux';
import createSagaMiddleware from 'redux-saga';
import get from 'lodash-es/get';

import reducers from './reducers';
import rootSaga from './sagas';

const compose = get(
  window,
  '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__',
  composeWithoutDevTools,
);

export default function createApplicationStore() {
  const sagaMiddleware = createSagaMiddleware();
  const store = createStore(
    reducers,
    compose(applyMiddleware(sagaMiddleware)),
  );
  sagaMiddleware.run(rootSaga);
  return store;
}<commit_msg>Report uncaught errors in sagas to BugsnagRealized we have a huge hole in our error monitoring—uncaught errorsthat happen inside `redux-saga` call paths are caught by `redux-saga`itself, meaning they’re not captured as uncaught exceptions or unhandledpromise rejections. So, we need to explicitly send them to Bugsnag.Fortunately, `redux-saga` does provide an `onError` callback when creatingthe middleware that actually runs sagas, which is intended for justthis use case. Add that callback and report errors to Bugsnag.<commit_after>import {
  compose as composeWithoutDevTools,
  createStore,
  applyMiddleware,
} from 'redux';
import createSagaMiddleware from 'redux-saga';
import get from 'lodash-es/get';

import reducers from './reducers';
import rootSaga from './sagas';
import {bugsnagClient} from './util/bugsnag';

const compose = get(
  window,
  '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__',
  composeWithoutDevTools,
);

export default function createApplicationStore() {
  const sagaMiddleware = createSagaMiddleware({
    onError(error) {
      bugsnagClient.notify(error);
    },
  });
  const store = createStore(
    reducers,
    compose(applyMiddleware(sagaMiddleware)),
  );
  sagaMiddleware.run(rootSaga);
  return store;
}
{'fraction_non_alphanumeric': 0.08826695371367062, 'fraction_numerical': 0.0, 'mean_word_length': 5.2592592592592595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6318824', 'n_tokens_mistral': 574, 'n_tokens_neox': 568, 'n_words': 168}