<commit_before>"use strict";

var _ = require('lodash');
const EventEmitter = require('events').EventEmitter;
const domain = require('domain');
const Util = require('./Util');
const co = require('co');
const coBind = require('co-bind');

/**
 * Context is your main class.
 * In an `action` and `before` context
 * will be your `this`.  Anything your attach
 * to context will be passed along. Plus context
 * adds a lot of nice conveniences.
 */
class Context extends EventEmitter {
  constructor() {
    super();

    this.domain = domain.create();

    this.domain.on('error', (err) => {
      this.emit('error', err);
    });
  }

  bindModules() {
    // lets bind context to sand grains
    if (sand && sand.modules && sand.modules.length > 0) {
      sand.modules.forEach(function(m) {
        if (typeof sand[m.name] !== 'undefined') {
          if (typeof sand[m.name].bindToContext === 'function') {
            sand[m.name].bindToContext(this);
          }
<commit_msg>don't emit error on domain error, log instead<commit_after>"use strict";

var _ = require('lodash');
const EventEmitter = require('events').EventEmitter;
const domain = require('domain');
const Util = require('./Util');
const co = require('co');
const coBind = require('co-bind');

/**
 * Context is your main class.
 * In an `action` and `before` context
 * will be your `this`.  Anything your attach
 * to context will be passed along. Plus context
 * adds a lot of nice conveniences.
 */
class Context extends EventEmitter {
  constructor() {
    super();

    this.domain = domain.create();

    this.domain.on('error', (err) => {
      sand.error(err);
    });
  }

  bindModules() {
    // lets bind context to sand grains
    if (sand && sand.modules && sand.modules.length > 0) {
      sand.modules.forEach(function(m) {
        if (typeof sand[m.name] !== 'undefined') {
          if (typeof sand[m.name].bindToContext === 'function') {
            sand[m.name].bindToContext(this);
          }

{'fraction_non_alphanumeric': 0.15473790322580644, 'fraction_numerical': 0.0010080645161290322, 'mean_word_length': 3.0927835051546393, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2075743', 'n_tokens_mistral': 589, 'n_tokens_neox': 581, 'n_words': 176}