index.js
function onResponse (res) {
      endTime = getTimeMs(endTime)

      res = Object.assign(res, { opDuration: endTime })

      if (res.error) {
        appendRes = res
      } else {
        log.info(
          {
            res: res,
            duration: endTime
          },
          'end of the request'
        )
      }
    }
function onResponse (res) {
      endTime = getTimeMs(endTime)

      res = Object.assign(res, { opDuration: endTime })

      if (res.error) {
        appendRes = res
      } else {
        log.info(
          {
            res: res,
            duration: endTime
          },
          'end of the request'
        )
      }
    }
function onResponse ( res ) { endTime = getTimeMs ( endTime ) res = Object . assign ( res , { opDuration : endTime } ) if ( res . error ) { appendRes = res } else { log . info ( { res : res , duration : endTime } , 'end of the request' ) } }
in case of res.error should fallback to the error emitter and should pass the res object
in case of res . error should fallback to the error emitter and should pass the res object