<commit_before>'use strict';

const Promise = require('promise');
const uuid = require('uuid/v4');
const cassandraConnector = require('../../clients/cassandra/CassandraConnector');
const blobStorageClient = require('../../clients/storage/BlobStorageClient');
const withRunTime = require('../shared').withRunTime;
const trackEvent = require('../../clients/appinsights/AppInsightsClient').trackEvent;
const apiUrlBase = process.env.FORTIS_CENTRAL_ASSETS_HOST || 'https://fortiscentral.blob.core.windows.net';
const STREAM_PIPELINE_TWITTER = 'twitter';
const STREAM_CONNECTOR_TWITTER = 'Twitter';

const TRUSTED_SOURCES_CONNECTOR_TWITTER = 'Twitter';
const TRUSTED_SOURCES_CONNECTOR_FACEBOOK = 'FacebookPage';
const TRUSTED_SOURCES_RANK_DEFAULT = 10;

function _insertTopics(siteType) {
  return new Promise((resolve, reject) => {
    const uri = `${apiUrlBase}/settings/siteTypes/${siteType}/topics/defaultTopics.json`;
    blobStorageClient.fetchJson(uri)
      .then(response => {
        const mutations = [];<commit_msg>Add siteType error handling<commit_after>'use strict';

const Promise = require('promise');
const uuid = require('uuid/v4');
const cassandraConnector = require('../../clients/cassandra/CassandraConnector');
const blobStorageClient = require('../../clients/storage/BlobStorageClient');
const withRunTime = require('../shared').withRunTime;
const trackEvent = require('../../clients/appinsights/AppInsightsClient').trackEvent;
const apiUrlBase = process.env.FORTIS_CENTRAL_ASSETS_HOST || 'https://fortiscentral.blob.core.windows.net';
const STREAM_PIPELINE_TWITTER = 'twitter';
const STREAM_CONNECTOR_TWITTER = 'Twitter';

const TRUSTED_SOURCES_CONNECTOR_TWITTER = 'Twitter';
const TRUSTED_SOURCES_CONNECTOR_FACEBOOK = 'FacebookPage';
const TRUSTED_SOURCES_RANK_DEFAULT = 10;

function _insertTopics(siteType) {
  return new Promise((resolve, reject) => {
    if(!siteType || !siteType.length) {
      return reject('insertTopics: siteType is not defined');
    }
    const uri = `${apiUrlBase}/settings/siteTypes/${siteType}/topics/defaultTopics.json`;
    blobStorageClient.fetchJson(uri)
      .then(response => {
        const mutations = [];
{'fraction_non_alphanumeric': 0.13896583564173592, 'fraction_numerical': 0.002770083102493075, 'mean_word_length': 5.771875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '405342', 'n_tokens_mistral': 697, 'n_tokens_neox': 670, 'n_words': 115}