github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/uaa/errors.go (about) 1 package uaa 2 3 import "fmt" 4 5 // RawHTTPStatusError represents any response with a 4xx or 5xx status code. 6 type RawHTTPStatusError struct { 7 StatusCode int 8 RawResponse []byte 9 } 10 11 func (r RawHTTPStatusError) Error() string { 12 return fmt.Sprintf("Error Code: %d\nRaw Response: %s", r.StatusCode, r.RawResponse) 13 } 14 15 // UAAErrorResponse represents a generic UAA error response. 16 type UAAErrorResponse struct { 17 Type string `json:"error"` 18 Description string `json:"error_description"` 19 } 20 21 func (e UAAErrorResponse) Error() string { 22 return fmt.Sprintf("Error Type: %s\nDescription: %s", e.Type, e.Description) 23 } 24 25 // ConflictError is returned when the response status code is 409. It 26 // represents when there is a conflict in the state of the requested resource. 27 type ConflictError struct { 28 Message string 29 } 30 31 func (e ConflictError) Error() string { 32 return e.Message 33 } 34 35 // UnverifiedServerError replaces x509.UnknownAuthorityError when the server 36 // has SSL but the client is unable to verify it's certificate 37 type UnverifiedServerError struct { 38 URL string 39 } 40 41 func (e UnverifiedServerError) Error() string { 42 return "x509: certificate signed by unknown authority" 43 } 44 45 // RequestError represents a generic error encountered while performing the 46 // HTTP request. This generic error occurs before a HTTP response is obtained. 47 type RequestError struct { 48 Err error 49 } 50 51 func (e RequestError) Error() string { 52 return e.Err.Error() 53 } 54 55 // BadCredentialsError is returned when the credentials are rejected. 56 type BadCredentialsError struct { 57 Message string 58 } 59 60 func (e BadCredentialsError) Error() string { 61 return e.Message 62 } 63 64 // InvalidAuthTokenError is returned when the client has an invalid 65 // authorization header. 66 type InvalidAuthTokenError struct { 67 Message string 68 } 69 70 func (e InvalidAuthTokenError) Error() string { 71 return e.Message 72 } 73 74 // InsufficientScopeError is returned when the client has insufficient scope 75 type InsufficientScopeError struct { 76 Message string 77 } 78 79 func (e InsufficientScopeError) Error() string { 80 return e.Message 81 } 82 83 // InvalidSCIMResourceError is returned usually when the client tries to create an inproperly formatted username 84 type InvalidSCIMResourceError struct { 85 Message string 86 } 87 88 func (e InvalidSCIMResourceError) Error() string { 89 return e.Message 90 }