function isTabBarFail(err) {
  const msg = err && err.errMsg ? String(err.errMsg) : ''
  return msg.includes('TabBar') && msg.includes('fail')
}

uni.addInterceptor({
  returnValue(res) {
    if (!(!!res && (typeof res === 'object' || typeof res === 'function') && typeof res.then === 'function')) {
      return res
    }
    return new Promise((resolve, reject) => {
      res.then((tuple) => {
        if (!tuple) {
          return resolve(tuple)
        }
        if (tuple[0]) {
          if (isTabBarFail(tuple[0])) {
            return resolve(tuple[0])
          }
          return reject(tuple[0])
        }
        return resolve(tuple[1])
      })
    })
  }
})