Skip to content

Commit

Permalink
make error message for creds not found meaningful
Browse files Browse the repository at this point in the history
  • Loading branch information
sharanyad committed Oct 23, 2019
1 parent 6125b11 commit 18080d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions agent/handlers/task_server_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func TestCredentialsV2RequestWithNoArguments(t *testing.T) {
func TestCredentialsV1RequestWhenCredentialsIdNotFound(t *testing.T) {
expectedErrorMessage := &utils.ErrorMessage{
Code: v1.ErrInvalidIDInRequest,
Message: fmt.Sprintf("CredentialsV1Request: ID not found"),
Message: fmt.Sprintf("CredentialsV1Request: Credentials not found"),
HTTPErrorCode: http.StatusBadRequest,
}
path := credentials.V1CredentialsPath + "?id=" + credentialsID
Expand All @@ -337,7 +337,7 @@ func TestCredentialsV1RequestWhenCredentialsIdNotFound(t *testing.T) {
func TestCredentialsV2RequestWhenCredentialsIdNotFound(t *testing.T) {
expectedErrorMessage := &utils.ErrorMessage{
Code: v1.ErrInvalidIDInRequest,
Message: fmt.Sprintf("CredentialsV2Request: ID not found"),
Message: fmt.Sprintf("CredentialsV2Request: Credentials not found"),
HTTPErrorCode: http.StatusBadRequest,
}
path := credentials.V2CredentialsPath + "/" + credentialsID
Expand Down
4 changes: 2 additions & 2 deletions agent/handlers/v1/credentials_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func CredentialsHandlerImpl(w http.ResponseWriter, r *http.Request, auditLogger
// processCredentialsRequest returns the response json containing credentials for the credentials id in the request
func processCredentialsRequest(credentialsManager credentials.Manager, r *http.Request, credentialsID string, errPrefix string) ([]byte, string, string, *handlersutils.ErrorMessage, error) {
if credentialsID == "" {
errText := errPrefix + "No ID in the request"
errText := errPrefix + "No Credential ID in the request"
seelog.Infof("%s. Request IP Address: %s", errText, r.RemoteAddr)
msg := &handlersutils.ErrorMessage{
Code: ErrNoIDInRequest,
Expand All @@ -93,7 +93,7 @@ func processCredentialsRequest(credentialsManager credentials.Manager, r *http.R

credentials, ok := credentialsManager.GetTaskCredentials(credentialsID)
if !ok {
errText := errPrefix + "ID not found"
errText := errPrefix + "Credentials not found"
seelog.Infof("%s. Request IP Address: %s", errText, r.RemoteAddr)
msg := &handlersutils.ErrorMessage{
Code: ErrInvalidIDInRequest,
Expand Down

0 comments on commit 18080d9

Please sign in to comment.