in aws-ssm-document/src/main/java/com/amazonaws/ssm/document/DocumentExceptionTranslator.java [48:82]
RuntimeException getCfnException(@NonNull final SsmException e, @NonNull String documentName, @NonNull String operationName,
@NonNull final Logger logger) {
logger.log(String.format(EXCEPTION_METRIC_FILTER_PATTERN, operationName, e.getClass()));
if (e instanceof DocumentLimitExceededException || e instanceof DocumentVersionLimitExceededException) {
return new CfnServiceLimitExceededException(ResourceModel.TYPE_NAME, e.getMessage());
} else if (e instanceof DocumentAlreadyExistsException) {
return new CfnAlreadyExistsException(ResourceModel.TYPE_NAME, documentName);
} else if (e instanceof MaxDocumentSizeExceededException || e instanceof InvalidDocumentContentException
|| e instanceof InvalidDocumentVersionException || e instanceof InvalidDocumentSchemaVersionException
|| e instanceof AutomationDefinitionNotFoundException || e instanceof AutomationDefinitionVersionNotFoundException) {
return new CfnInvalidRequestException(e.getMessage(), e);
} else if (e instanceof InvalidDocumentException || e instanceof InvalidResourceIdException) {
return new CfnNotFoundException(ResourceModel.TYPE_NAME, documentName);
} else if (e.isThrottlingException()) {
return new CfnThrottlingException(operationName, e);
} else if (e instanceof InternalServerErrorException) {
return new CfnServiceInternalErrorException(operationName, e);
} else if (e.getCause() instanceof IOException) {
return new CfnNetworkFailureException(operationName, e);
} else if (e.statusCode() == GENERIC_USER_ERROR_STATUS_CODE) {
return new CfnInvalidRequestException(e.getMessage(), e);
}
return new CfnGeneralServiceException(e);
}