auth
2014-08-01
Child:65c49af1ed3f
auth/errors.go
Continue our descent to horribleness. Remove all the nonsense about "extensibility" and "clean separation of concerns", instead hardcoding connections to decisions. Remove all those "test" things that stopped passing.
1 package oauth2
3 import "errors"
5 const (
6 ErrorServerError = "server_error"
7 ErrorInvalidRequest = "invalid_request"
8 ErrorAccessDenied = "access_denied"
9 )
11 var (
12 ClientNotFoundError = errors.New("Client not found.")
13 URIMissingError = errors.New("Redirect URI missing.")
14 InvalidMethodError = errors.New("Invalid request method.")
15 InternalServerError = errors.New("Internal server error.")
16 ErrorNotAuthenticated = errors.New("Not authenticated.")
17 )
19 type URIFormatError string
21 func (err URIFormatError) Error() string {
22 return "Invalid URI format: " + string(err)
23 }
25 type InvalidClientIDError string
27 func (err InvalidClientIDError) Error() string {
28 return "Invalid client ID: " + string(err)
29 }
31 type URIMismatchError struct {
32 uri string
33 mismatch string
34 }
36 func (err URIMismatchError) Error() string {
37 return "Supplied redirect URI " + err.mismatch + " does not match the redirect in the database (" + err.uri + ")"
38 }
40 func NewURIMismatchError(uri, mismatch string) error {
41 return URIMismatchError{
42 uri: uri,
43 mismatch: mismatch,
44 }
45 }