github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/session/status.go (about) 1 package session 2 3 import ( 4 "github.com/TrueCloudLab/frostfs-api-go/v2/status" 5 statusgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc" 6 ) 7 8 // LocalizeFailStatus checks if passed global status.Code is related to session failure and: 9 // 10 // then localizes the code and returns true, 11 // else leaves the code unchanged and returns false. 12 // 13 // Arg must not be nil. 14 func LocalizeFailStatus(c *status.Code) bool { 15 return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_SESSION)) 16 } 17 18 // GlobalizeFail globalizes local code of session failure. 19 // 20 // Arg must not be nil. 21 func GlobalizeFail(c *status.Code) { 22 c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_SESSION)) 23 } 24 25 const ( 26 // StatusTokenNotFound is a local status.Code value for 27 // TOKEN_NOT_FOUND session failure. 28 StatusTokenNotFound status.Code = iota 29 // StatusTokenExpired is a local status.Code value for 30 // TOKEN_EXPIRED session failure. 31 StatusTokenExpired 32 )