<commit_before>AutoForm.addHooks('usersEnrollForm', {
  onError (formType, error) {
    // Show the error to end user
    // TODO: add internationalization support for specefic error type(s)
    FlashMessages.sendError(`${error.error}: ${error.reason}`, { autoHide: false });
  }
});
<commit_msg>Make sure error type exists before flash message<commit_after>AutoForm.addHooks('usersEnrollForm', {
  onError (formType, error) {
    // Show the error to end user
    // TODO: add internationalization support for specefic error type(s)

    // Make sure there is an error type, otherwise don't show error
    // to prevent 'unknown' or undefined error messages from triggering flash message
    if (error.error) {
      FlashMessages.sendError(`${error.error}: ${error.reason}`, { autoHide: false });
    }
  }
});

{'fraction_non_alphanumeric': 0.12177121771217712, 'fraction_numerical': 0.0, 'mean_word_length': 3.8452380952380953, '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': '5003463', 'n_tokens_mistral': 235, 'n_tokens_neox': 233, 'n_words': 75}