<commit_before>var _ = require('./dash')
var Promise = require('es6-promise').Promise
var invariant = require('./invariant')
var Path = require('./path')

module.exports = function transition (options) {
  options = options || {}

  let router = options.router
  let log = router.log
  let logError = router.logError

  let path = options.path
  let match = options.match
  let routes = match.routes
  let params = match.params
  let query = match.query

  let id = options.id
  let startTime = Date.now()
  log('---')
  log('Transition #' + id, 'to', path)
  log('Transition #' + id, 'routes:', _.pluck(routes, 'name'))
  log('Transition #' + id, 'params:', params)
  log('Transition #' + id, 'query:', query)

  // create the transition promise
  var resolve, reject
  var promise = new Promise(function (res, rej) {
    resolve = res
    reject = rej
  })

  // 1. make transition errors loud
  // 2. by adding this handler we make sure
  //    we don't trigger the default 'Potentially
  //    unhandled rejection' for cancellations
  promise.then(function () {
    log('Transition #' + id, 'completed in', (Date.now() - startTime) + 'ms')
  }).catch(function (err) {
    if (err.type !== 'TransitionRedirected' && err.type !== 'TransitionCancelled') {
      log('Transition #' + id, 'FAILED')
      logError(err)
    }
  })

  var cancelled = false

  var transition = {
    id: id,<commit_msg>Log err.stack - makes error output look much more useful<commit_after>var _ = require('./dash')
var Promise = require('es6-promise').Promise
var invariant = require('./invariant')
var Path = require('./path')

module.exports = function transition (options) {
  options = options || {}

  let router = options.router
  let log = router.log
  let logError = router.logError

  let path = options.path
  let match = options.match
  let routes = match.routes
  let params = match.params
  let query = match.query

  let id = options.id
  let startTime = Date.now()
  log('---')
  log('Transition #' + id, 'to', path)
  log('Transition #' + id, 'routes:', _.pluck(routes, 'name'))
  log('Transition #' + id, 'params:', params)
  log('Transition #' + id, 'query:', query)

  // create the transition promise
  var resolve, reject
  var promise = new Promise(function (res, rej) {
    resolve = res
    reject = rej
  })

  // 1. make transition errors loud
  // 2. by adding this handler we make sure
  //    we don't trigger the default 'Potentially
  //    unhandled rejection' for cancellations
  promise.then(function () {
    log('Transition #' + id, 'completed in', (Date.now() - startTime) + 'ms')
  }).catch(function (err) {
    if (err.type !== 'TransitionRedirected' && err.type !== 'TransitionCancelled') {
      log('Transition #' + id, 'FAILED')
      logError(err.stack)
    }
  })

  var cancelled = false

  var transition = {
    id: id,
{'fraction_non_alphanumeric': 0.14998243765367053, 'fraction_numerical': 0.002107481559536354, 'mean_word_length': 3.169838945827233, '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': '6841033', 'n_tokens_mistral': 896, 'n_tokens_neox': 877, 'n_words': 269}