in aws-auditmanager-assessment/src/main/java/software/amazon/auditmanager/assessment/ExceptionTranslator.java [23:39]
public static BaseHandlerException translateToCfnException(
final AwsServiceException exception,
final String identifier) {
if (exception instanceof AccessDeniedException) {
return new CfnAccessDeniedException(ResourceModel.TYPE_NAME, exception);
}
if (exception instanceof ResourceNotFoundException) {
return new CfnNotFoundException(ResourceModel.TYPE_NAME, identifier, exception);
}
if (exception instanceof ValidationException) {
return new CfnInvalidRequestException(exception);
} if (exception instanceof AuditManagerException
|| exception instanceof InternalServerException) {
return new CfnServiceInternalErrorException(exception);
}
return new CfnGeneralServiceException(exception.getMessage(), exception);
}