github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/libpages/config/errors.go (about) 1 package config 2 3 import "fmt" 4 5 // ErrInvalidPermissions is returned when an invalid permissions string appears 6 // in the config. 7 type ErrInvalidPermissions struct { 8 permissions string 9 } 10 11 // Error implements the error interface. 12 func (e ErrInvalidPermissions) Error() string { 13 return "invalid permission(s) " + e.permissions 14 } 15 16 // ErrDuplicatePerPathConfigPath is returned when multiple per-user configs are 17 // defined for the same path in config. 18 type ErrDuplicatePerPathConfigPath struct { 19 cleanedPath string 20 } 21 22 // Error implements the error interface. 23 func (e ErrDuplicatePerPathConfigPath) Error() string { 24 return "duplicate access control for " + e.cleanedPath 25 } 26 27 // ErrInvalidVersion is returned when Version field of the config is invalid. 28 type ErrInvalidVersion struct { 29 versionStr string 30 } 31 32 // Error implements the error interface. 33 func (e ErrInvalidVersion) Error() string { 34 return fmt.Sprintf("invalid version %s", e.versionStr) 35 } 36 37 // ErrUndefinedUsername is returned when a username appears in a per-path 38 // config but it's not defined in the config's Users section. 39 type ErrUndefinedUsername struct { 40 username string 41 } 42 43 // Error implements the error interface. 44 func (e ErrUndefinedUsername) Error() string { 45 return fmt.Sprintf("undefined username %s", e.username) 46 } 47 48 // ErrACLsPerPathConfigsBothPresent is returned when we are parsing a ConfigV1 49 // that has both ACLs and PerPathConfigs defined. 50 type ErrACLsPerPathConfigsBothPresent struct{} 51 52 // Error implements the error interface. 53 func (ErrACLsPerPathConfigsBothPresent) Error() string { 54 return "We are deprecating `acls` and moving to `per_path_configs`. " + 55 "Please use `per_path_configs`." 56 } 57 58 // ErrInvalidConfig is returned when an invalid config is provided. 59 type ErrInvalidConfig struct { 60 msg string 61 } 62 63 // Error implements the error interface. 64 func (e ErrInvalidConfig) Error() string { 65 return fmt.Sprintf("invalid config: %s", e.msg) 66 }