old_contents: 'use strict'
  
  const Env = use('Env')
  const Ouch = use('youch')
  const Http = exports = module.exports = {}
  
  /**
   * handle errors occured during a Http request.
   *
   * @param  {Object} error
   * @param  {Object} request
   * @param  {Object} response
   */
  Http.handleError = function * (error, request, response) {
    /**
     * DEVELOPMENT REPORTER
     */
    if (Env.get('NODE_ENV') === 'development') {
      const ouch = new Ouch().pushHandler(
        new Ouch.handlers.PrettyPageHandler('blue', null, 'sublime')
      )
      ouch.handleException(error, request.request, response.response, (output) => {
        console.error(error.stack)
      })
      return
    }
  
    /**
     * PRODUCTION REPORTER
     */
    const status = error.status || 500
    console.error(error.stack)
    yield response.status(status).sendView('errors/index', {error})
  }
  
  /**
   * listener for Http.start event, emitted after
   * starting http server.
   */
  Http.onStart = function () {
  }
  
new_contents: 'use strict'
  
  const Env = use('Env')
  const Youch = use('youch')
  const Http = exports = module.exports = {}
  
  /**
   * handle errors occured during a Http request.
   *
   * @param  {Object} error
   * @param  {Object} request
   * @param  {Object} response
   */
  Http.handleError = function * (error, request, response) {
    const status = error.status || 500
  
    /**
     * DEVELOPMENT REPORTER
     */
    if (Env.get('NODE_ENV') === 'development') {
      const youch = new Youch(error, request.request)
      const type = request.accepts('json', 'html')
      const formatMethod = type === 'json' ? 'toJSON' : 'toHTML'
      const formattedErrors = yield youch[formatMethod]()
      response.status(status).send(formattedErrors)
      return
    }
  
    /**
     * PRODUCTION REPORTER
     */
    console.error(error.stack)
    yield response.status(status).sendView('errors/index', {error})
  }
  
  /**
   * listener for Http.start event, emitted after
   * starting http server.
   */
  Http.onStart = function () {
  }
  
subject: use newer youch for error display