function errorHandler(err, txn, res, next) {
    var mode = 'query'
      , params = {}
      , respond;
    if (txn.req && txn.req.responseMode) {