Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:[CORE-1379] handle noentityfound exception for iam policies #1556

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ public interface PacmanSdkConstants {
/** The status unknown. */
String STATUS_UNKNOWN="unknown";

String STATUS_UNKNOWN_MESSAGE = "unable to determine for this resource";

/** The error desc key. */
String ERROR_DESC_KEY = "errorDesc";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;
import java.util.Set;

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
Expand Down Expand Up @@ -149,9 +150,15 @@ public PolicyResult execute(final Map<String, String> ruleParam, Map<String, Str
}
}

} catch (Exception e) {
logger.error(PacmanRuleConstants.UNABLE_TO_GET_CLIENT, e);
throw new InvalidInputException(PacmanRuleConstants.UNABLE_TO_GET_CLIENT, e);
}
catch(NoSuchEntityException exception){
logger.error("NoSuchEntityException thrown..", exception);
return new PolicyResult(PacmanSdkConstants.STATUS_UNKNOWN, PacmanSdkConstants.STATUS_UNKNOWN_MESSAGE,
annotation);
}
catch (Exception e) {
logger.error(PacmanRuleConstants.UNABLE_TO_GET_CLIENT, e);
throw new InvalidInputException(PacmanRuleConstants.UNABLE_TO_GET_CLIENT, e);
}
logger.debug("========IAMRoleWithUnapprovedAccessRule ended=========");
return new PolicyResult(PacmanSdkConstants.STATUS_SUCCESS, PacmanRuleConstants.SUCCESS_MESSAGE);
Expand Down
Loading