<commit_before>/* Credit for this reducer goes to StashAway! Incredibly helpful post:
* https://medium.com/stashaway-engineering/react-redux-tips-better-way
* -to-handle-loading-flags-in-your-reducers-afda42a804c6
*/

function requestErrors(state = {}, action) {
	const { type, error } = action
	const matches = /(.*)_(REQUEST|FAILURE)/.exec(type)

	// not a *_REQUEST or *_FAILURE action, ignore
	if (!matches) return state

	const [, requestName, requestState] = matches
	return {
		...state,
		// Store error
		// e.g. stores errorMessage when receiving POST_FEEDBACK_FAILURE
		// else clears error message when receiving POST_FEEDBACK_REQUEST
		[requestName]: requestState === 'FAILURE' ? error : ''
	}
}<commit_msg>Correct incorrect error object being stored in requestErrors reducer<commit_after>/* Credit for this reducer goes to StashAway! Incredibly helpful post:
* https://medium.com/stashaway-engineering/react-redux-tips-better-way
* -to-handle-loading-flags-in-your-reducers-afda42a804c6
*/

function requestErrors(state = {}, action) {
	const { type, error } = action
	const matches = /(.*)_(REQUEST|FAILURE)/.exec(type)

	// not a *_REQUEST or *_FAILURE action, ignore
	if (!matches) return state

	const [, requestName, requestState] = matches
	return {
		...state,
		// Store error
		// e.g. stores errorMessage when receiving POST_FEEDBACK_FAILURE
		// else clears error message when receiving POST_FEEDBACK_REQUEST
		[requestName]: requestState === 'FAILURE' ? error.message : ''
	}
}
{'fraction_non_alphanumeric': 0.12574850299401197, 'fraction_numerical': 0.007984031936127744, 'mean_word_length': 4.258741258741258, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4796822', 'n_tokens_mistral': 498, 'n_tokens_neox': 467, 'n_words': 126}