// ToStatus implements the ExportableError interface for DiskBlockCacheError.
350873
func (e DiskBlockCacheError) ToStatus() (s keybase1.Status) {
	s.Code = StatusCodeDiskBlockCacheError
	s.Name = "DISK_BLOCK_CACHE_ERROR"
	s.Desc = e.Msg
	return
}
1274500
func (e ServerErrorClassicTLFDoesNotExist) ToStatus() (s keybase1.Status) {
	s.Code = StatusCodeServerErrorClassicTLFDoesNotExist
	s.Name = "CLASSIC_TLF_DOES_NOT_EXIST"
	s.Desc = e.Error()
	return
}
778331
func (e KeyGenError) ToStatus() (s keybase1.Status) {
	s.Code = SCKeyBadGen
	s.Name = "KEY_BAD_GEN"
	s.Desc = e.Msg
	return
}
262084
func (d *Driver) Status() [][2]string {
	return [][2]string{
		{"Backing Filesystem", d.backingFs},
		{"Support Copy-On-Write", fmt.Sprintf("%v", d.cow)},
		{"Block Filesystem", d.blockFs},
		{"Block Size", fmt.Sprintf("%s", units.HumanSize(float64(d.blockSize)))},
	}
}
388164
func (e LoggedInWrongUserError) ToStatus() (s keybase1.Status) {
	s.Code = SCAlreadyLoggedIn
	s.Name = "ALREADY_LOGGED_IN"
	s.Desc = e.Error()
	return
}
1121310
func (cache *diskBlockCacheWrapped) Status(
	ctx context.Context) map[string]DiskBlockCacheStatus {
	// This is a write operation but we are only reading the pointers to the
	// caches. So we use a read lock.
	cache.mtx.RLock()
	defer cache.mtx.RUnlock()
	statuses := make(map[string]DiskBlockCacheStatus, 2)
	if cache.workingSetCache != nil {
		for name, status := range cache.workingSetCache.Status(ctx) {
			statuses[name] = status
		}
	}
	if cache.syncCache == nil {
		return statuses
	}
	for name, status := range cache.syncCache.Status(ctx) {
		statuses[name] = status
	}
	return statuses
}
1191936
func (e ServerErrorMaxRefExceeded) ToStatus() (s keybase1.Status) {
	s.Code = StatusCodeServerErrorMaxRefExceeded
	s.Name = "BLOCK_MAXREFEXCEEDED"
	s.Desc = e.Msg
	return
}
310664
func (cache *DiskQuotaCacheLocal) Status(_ context.Context) DiskQuotaCacheStatus {
	select {
	case <-cache.startedCh:
	case <-cache.startErrCh:
		return DiskQuotaCacheStatus{StartState: DiskQuotaCacheStartStateFailed}
	default:
		return DiskQuotaCacheStatus{StartState: DiskQuotaCacheStartStateStarting}
	}

	cache.lock.RLock()
	defer cache.lock.RUnlock()

	return DiskQuotaCacheStatus{
		StartState: DiskQuotaCacheStartStateStarted,
		NumQuotas:  uint64(len(cache.quotasCached)),
		Hits:       rateMeterToStatus(cache.hitMeter),
		Misses:     rateMeterToStatus(cache.missMeter),
		Puts:       rateMeterToStatus(cache.putMeter),
	}
}
1093820
func (hc *HealthCheckImpl) CacheStatus() TabletsCacheStatusList {
	tcsMap := hc.cacheStatusMap()
	tcsl := make(TabletsCacheStatusList, 0, len(tcsMap))
	for _, tcs := range tcsMap {
		tcsl = append(tcsl, tcs)
	}
	sort.Sort(tcsl)
	return tcsl
}
164765
func (v *View) OverwriteStatus() bool {
	v.lock.Lock()
	defer v.lock.Unlock()
	return v.overwrite
}
929272
func (e ServerErrorUnauthorized) ToStatus() (s keybase1.Status) {
	s.Code = StatusCodeServerErrorUnauthorized
	s.Name = "SESSION_UNAUTHORIZED"
	s.Desc = e.Msg
	return
}
326014
func (w *restoreWorker) RestoreStatus() state.RestoreStatus {
	w.mu.Lock()
	defer w.mu.Unlock()
	return w.status
}
1286495
func FromStatus(s *status.Status) *platform.Error {
	if s == nil || s.Code() == codes.OK {
		return nil
	}

	msg := s.Message()
	var perr platform.Error
	if err := json.Unmarshal([]byte(msg), &perr); err != nil {
		return &platform.Error{
			Err:  errors.New(msg),
			Code: platform.EInternal,
		}
	}

	return &perr
}
89510
func withStatus(err error, status int) *protocolError {
	if _, ok := err.(*protocolError); ok {
		panic("protocolError in protocolError")
	}
	if err == nil {
		return nil
	}
	return &protocolError{err, status}
}
1178940
func toStatus(err error) error {
	switch {
	case err == mapper.ErrNoSuchJob:
		return status.Errorf(codes.NotFound, "no such mapping job")
	case transient.Tag.In(err):
		return status.Errorf(codes.Internal, err.Error())
	case err != nil:
		return status.Errorf(codes.InvalidArgument, err.Error())
	default:
		return nil
	}
}
381376
func (e ServerErrorCannotReadFinalizedTLF) ToStatus() (s keybase1.Status) {
	s.Code = StatusCodeServerErrorCannotReadFinalizedTLF
	s.Name = "CANNOT_READ_FINALIZED_TLF"
	s.Desc = e.Error()
	return
}
151316
func (e simpleFSError) ToStatus() keybase1.Status {
	return keybase1.Status{
		Name: e.reason,
		Code: int(keybase1.StatusCode_SCGeneric),
		Desc: e.Error(),
	}
}