<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Orc.ReactProcessor.Core
{
    public static class JavascriptShimms
    {
        public const string ConsoleShim = @"var global = global || {};

            // Basic console shim. Caches all calls to console methods.
            function MockConsole() {
	            this._calls = [];
	            ['log', 'error', 'warn', 'debug', 'info', 'dir', 'group', 'groupEnd', 'groupCollapsed'].forEach(function (methodName) {
		            this[methodName] = this._handleCall.bind(this, methodName);
	            }, this);
            }
            MockConsole.prototype = {
	            _handleCall: function(methodName/*, ...args*/) {
		            var serializedArgs = [];
		            for (var i = 1; i < arguments.length; i++) {
			            serializedArgs.push(JSON.stringify(arguments[i]));<commit_msg>added try catch arround shim<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Orc.ReactProcessor.Core
{
    public static class JavascriptShimms
    {
        public const string ConsoleShim = @"var global = global || {};

            // Basic console shim. Caches all calls to console methods.
            function MockConsole() {
	            this._calls = [];
	            ['log', 'error', 'warn', 'debug', 'info', 'dir', 'group', 'groupEnd', 'groupCollapsed'].forEach(function (methodName) {
		            this[methodName] = this._handleCall.bind(this, methodName);
	            }, this);
            }
            MockConsole.prototype = {
	            _handleCall: function(methodName/*, ...args*/) {
		            var serializedArgs = [];
		            for (var i = 1; i < arguments.length; i++) {
		            	try {
			        	    serializedArgs.push(JSON.stringify(arguments[i]));
			        	} catch(err){
			        		 serializedArgs.push('ServerSideError:'+err);
			        	}
{'fraction_non_alphanumeric': 0.13004926108374384, 'fraction_numerical': 0.0009852216748768472, 'mean_word_length': 2.2034700315457414, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5820293', 'n_tokens_mistral': 575, 'n_tokens_neox': 536, 'n_words': 132}