github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/service/errors.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package service 5 6 import ( 7 "fmt" 8 9 "github.com/keybase/client/go/libkb" 10 "github.com/keybase/client/go/protocol/keybase1" 11 ) 12 13 type BadTrackSessionError struct { 14 i int 15 } 16 17 func (e BadTrackSessionError) Error() string { 18 return fmt.Sprintf("Bad track session; either not found or read (%d)", e.i) 19 } 20 21 func (e BadTrackSessionError) ToStatus() keybase1.Status { 22 return keybase1.Status{ 23 Code: libkb.SCBadTrackSession, 24 Name: "BAD_TRACK_SESSION", 25 Desc: fmt.Sprintf("Follow session %d wasn't found", e.i), 26 } 27 } 28 29 type NotConnectedError struct{} 30 31 func (e NotConnectedError) Error() string { 32 return "Not connected" 33 } 34 35 type UserWasLoggedOutError struct{} 36 37 func (e UserWasLoggedOutError) Error() string { 38 return "User was logged out because the device is no longer valid" 39 } 40 41 func (e UserWasLoggedOutError) ToStatus() (s keybase1.Status) { 42 s.Code = libkb.SCNoSession 43 s.Name = "NO_SESSION" 44 s.Desc = e.Error() 45 return 46 }