<commit_before>import React from 'react';
import { t } from 'app/i18next-t';
import { AppIcon, twitterIcon } from '../shell/icons';
import { NotifyInput } from '../notifications/notifications';
import ExternalLink from '../dim-ui/ExternalLink';

/**
 * Generates parameters for a toaster based on an error, including DIM and Bungie twitter links.
 *
 * Use this for when you suspect Bungie.net is down.
 */
export function bungieErrorToaster(e: Error): NotifyInput {
  return {
    type: 'error',
    title: t('BungieService.ErrorTitle'),
    body: (
      <>
        {e.message}{' '}
        <div>
          {t('BungieService.Twitter')}{' '}
          <ExternalLink href="http://twitter.com/ThisIsDIM">Twitter</ExternalLink>{' '}
          <ExternalLink href="http://twitter.com/ThisIsDIM">
            <span style={{ fontSize: '1.5em', verticalAlign: 'middle' }}>
              <AppIcon icon={twitterIcon} />
            </span>
          </ExternalLink>
        </div>
      </>
    )
  };
}<commit_msg>Avoid broken error toasters<commit_after>import React from 'react';
import { t } from 'app/i18next-t';
import { AppIcon, twitterIcon } from '../shell/icons';
import { NotifyInput } from '../notifications/notifications';
import ExternalLink from '../dim-ui/ExternalLink';

/**
 * Generates parameters for a toaster based on an error, including DIM and Bungie twitter links.
 *
 * Use this for when you suspect Bungie.net is down.
 */
export function bungieErrorToaster(e: Error): NotifyInput {
  return {
    type: 'error',
    title: t('BungieService.ErrorTitle'),
    body: (
      <>
        {e ? e.message : t('BungieService.Difficulties')}{' '}
        <div>
          {t('BungieService.Twitter')}{' '}
          <ExternalLink href="http://twitter.com/ThisIsDIM">Twitter</ExternalLink>{' '}
          <ExternalLink href="http://twitter.com/ThisIsDIM">
            <span style={{ fontSize: '1.5em', verticalAlign: 'middle' }}>
              <AppIcon icon={twitterIcon} />
            </span>
          </ExternalLink>
        </div>
      </>
    )
  };
}
{'fraction_non_alphanumeric': 0.1555232558139535, 'fraction_numerical': 0.003875968992248062, 'mean_word_length': 2.7073608617594256, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '7470053', 'n_tokens_mistral': 648, 'n_tokens_neox': 634, 'n_words': 153}