Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Changed error message
Browse files Browse the repository at this point in the history
Signed-off-by: Aashir Siddiqui <[email protected]>
  • Loading branch information
aashir21 committed Sep 12, 2024
1 parent 767f834 commit 971ab7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public HttpServletResponse handleGetRequest(String pathInfo, QueryParameters que
String loginId = queryParams.getSingleString(QUERY_PARAM_LOGIN_ID, null);
validateLoginId(loginId, pathInfo);
authTokensFromAuthStore = getTokensByLoginId(loginId);

} else {
authTokensFromAuthStore = getAllTokens();
}
Expand Down Expand Up @@ -298,7 +298,7 @@ private List<AuthToken> convertAuthStoreTokenIntoTokenBeans(List<IInternalAuthTo
private void validateLoginId(String loginId, String servletPath) throws InternalServletException {

if (loginId == null || loginId.trim().length() == 0) {
ServletError error = new ServletError(GAL5067_ERROR_MALFORMED_LOGINID, servletPath);
ServletError error = new ServletError(GAL5067_ERROR_INVALID_LOGINID, servletPath);
throw new InternalServletException(error, HttpServletResponse.SC_BAD_REQUEST);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public void testTokenByLoginIdGetRequestWithNullLoginIdReturnsBadRequest() throw

assertThat(servletResponse.getStatus()).isEqualTo(400);
checkErrorStructure(outStream.toString(), 5057, "GAL5057E",
"Failed to validate loginId. This could be because loginId is null or an empty string. Please check the loginId in the query paramaters provided.");
"Invalid login ID provided. This could be because no value was given for the loginId query parameter. Please check your provided loginId query parameter value and try again.");
}

@Test
Expand All @@ -285,7 +285,7 @@ public void testTokenByLoginIdGetRequestWithBlankLoginIdReturnsBadRequest() thro

assertThat(servletResponse.getStatus()).isEqualTo(400);
checkErrorStructure(outStream.toString(), 5057, "GAL5057E",
"Failed to validate loginId. This could be because loginId is null or an empty string. Please check the loginId in the query paramaters provided.");
"Invalid login ID provided. This could be because no value was given for the loginId query parameter. Please check your provided loginId query parameter value and try again.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public enum ServletErrorMessage {
GAL5064_FAILED_TO_REVOKE_TOKEN (5064, "E: Failed to revoke the token with the given ID. Please ensure that you have provided a valid ID representing an existing auth token in your request and try again"),
GAL5065_FAILED_TO_GET_TOKEN_ID_FROM_URL (5065, "E: Failed to retrieve a token ID from the request path. Please ensure that you have provided a valid ID representing an existing auth token in your request and try again"),
GAL5066_ERROR_NO_SUCH_TOKEN_EXISTS (5066, "E: No such token with the given ID exists. Please ensure that you have provided a valid ID representing an existing auth token in your request and try again"),
GAL5067_ERROR_MALFORMED_LOGINID (5057, "E: Failed to validate loginId. This could be because loginId is null or an empty string. Please check the loginId in the query paramaters provided."),
GAL5067_ERROR_INVALID_LOGINID (5057, "E: Invalid login ID provided. This could be because no value was given for the loginId query parameter. Please check your provided loginId query parameter value and try again."),

// OpenAPI Servlet...
GAL5071_FAILED_TO_PARSE_YAML_INTO_JSON (5071, "E: Internal server error. Failed to convert OpenAPI specification from YAML into JSON. Report the problem to your Galasa Ecosystem owner"),
Expand Down

0 comments on commit 971ab7f

Please sign in to comment.