public static ExceptionHistoryEntry create(
            AccessExecution failedExecution,
            String taskName,
            CompletableFuture<Map<String, String>> failureLabels) {
        Preconditions.checkNotNull(failedExecution, "No Execution is specified.");
        Preconditions.checkNotNull(taskName, "No task name is specified.");
        Preconditions.checkArgument(
                failedExecution.getFailureInfo().isPresent(),
                "The selected Execution " + failedExecution.getAttemptId() + " didn't fail.");

        final ErrorInfo failure = failedExecution.getFailureInfo().get();
        return new ExceptionHistoryEntry(
                failure.getException(),
                failure.getTimestamp(),
                failureLabels,
                taskName,
                failedExecution.getAssignedResourceLocation());
    }
@Test
    void testCreationFailure() {
        assertThatThrownBy(
                        () ->
                                ExceptionHistoryEntry.create(
                                        TestingAccessExecution.newBuilder()
                                                .withTaskManagerLocation(
                                                        new LocalTaskManagerLocation())
                                                .build(),
                                        "task name",
                                        FailureEnricherUtils.EMPTY_FAILURE_LABELS))
                .isInstanceOf(IllegalArgumentException.class);
    }