auth
49:73a9f7a6af54 Browse Files
Update error strings, add ErrNo*Store errors. Update error strings to consistently begin with a lowercase letter and end without punctuation, as per the Go style guide. See https://code.google.com/p/go-wiki/wiki/CodeReviewComments#Error_Strings For each type of Store, add an ErrNo*Store error (e.g., ErrNoTokenStore) variable, to prepare for our Context type, which will throw these errors when a Store is used without being set.
client.go grant.go profile.go token.go
1.1 --- a/client.go Mon Sep 29 00:58:42 2014 -0400 1.2 +++ b/client.go Wed Oct 15 23:22:19 2014 -0400 1.3 @@ -3,23 +3,24 @@ 1.4 import ( 1.5 "errors" 1.6 "net/url" 1.7 + "strings" 1.8 "time" 1.9 1.10 "code.secondbit.org/uuid" 1.11 - "strings" 1.12 ) 1.13 1.14 var ( 1.15 - ErrClientNotFound = errors.New("Client not found in ClientStore.") 1.16 - ErrClientAlreadyExists = errors.New("Client already exists in ClientStore.") 1.17 + ErrNoClientStore = errors.New("no ClientStore was specified for the Context") 1.18 + ErrClientNotFound = errors.New("client not found in ClientStore") 1.19 + ErrClientAlreadyExists = errors.New("client already exists in ClientStore") 1.20 1.21 - ErrEmptyChange = errors.New("Change must have at least one change in it.") 1.22 - ErrClientNameTooShort = errors.New("Client name must be at least 2 characters.") 1.23 - ErrClientNameTooLong = errors.New("Client name must be at most 32 characters.") 1.24 - ErrClientLogoTooLong = errors.New("Client logo must be at most 1024 characters.") 1.25 - ErrClientLogoNotURL = errors.New("Client logo must be a valid absolute URL.") 1.26 - ErrClientWebsiteTooLong = errors.New("Client website must be at most 1024 characters.") 1.27 - ErrClientWebsiteNotURL = errors.New("Client website must be a valid absolute URL.") 1.28 + ErrEmptyChange = errors.New("change must have at least one change in it") 1.29 + ErrClientNameTooShort = errors.New("client name must be at least 2 characters") 1.30 + ErrClientNameTooLong = errors.New("client name must be at most 32 characters") 1.31 + ErrClientLogoTooLong = errors.New("client logo must be at most 1024 characters") 1.32 + ErrClientLogoNotURL = errors.New("client logo must be a valid absolute URL") 1.33 + ErrClientWebsiteTooLong = errors.New("client website must be at most 1024 characters") 1.34 + ErrClientWebsiteNotURL = errors.New("client website must be a valid absolute URL") 1.35 ) 1.36 1.37 // Client represents a client that grants access
2.1 --- a/grant.go Mon Sep 29 00:58:42 2014 -0400 2.2 +++ b/grant.go Wed Oct 15 23:22:19 2014 -0400 2.3 @@ -8,8 +8,9 @@ 2.4 ) 2.5 2.6 var ( 2.7 - ErrGrantNotFound = errors.New("Grant not found in GrantStore.") 2.8 - ErrGrantAlreadyExists = errors.New("Grant already exists in GrantStore.") 2.9 + ErrNoGrantStore = errors.New("no GrantStore was specified for the Context") 2.10 + ErrGrantNotFound = errors.New("grant not found in GrantStore") 2.11 + ErrGrantAlreadyExists = errors.New("grant already exists in GrantStore") 2.12 ) 2.13 2.14 type Grant struct {
3.1 --- a/profile.go Mon Sep 29 00:58:42 2014 -0400 3.2 +++ b/profile.go Wed Oct 15 23:22:19 2014 -0400 3.3 @@ -13,6 +13,7 @@ 3.4 ) 3.5 3.6 var ( 3.7 + ErrNoProfileStore = errors.New("no ProfileStore was specified for the Context") 3.8 ErrProfileAlreadyExists = errors.New("profile already exists in ProfileStore") 3.9 ErrProfileNotFound = errors.New("profile not found in ProfileStore") 3.10 ErrLoginAlreadyExists = errors.New("login already exists in ProfileStore")
4.1 --- a/token.go Mon Sep 29 00:58:42 2014 -0400 4.2 +++ b/token.go Wed Oct 15 23:22:19 2014 -0400 4.3 @@ -8,8 +8,9 @@ 4.4 ) 4.5 4.6 var ( 4.7 - ErrTokenNotFound = errors.New("Token not found in TokenStore.") 4.8 - ErrTokenAlreadyExists = errors.New("Token already exists in TokenStore.") 4.9 + ErrNoTokenStore = errors.New("no TokenStore was specified for the Context") 4.10 + ErrTokenNotFound = errors.New("token not found in TokenStore") 4.11 + ErrTokenAlreadyExists = errors.New("token already exists in TokenStore") 4.12 ) 4.13 4.14 type Token struct {