Source:
protected void runWithHeartbeat(TaskRequest request) { try { workspaceManager.withExtractedArchive(request, () -> callback.openArchive(request), (projectPath) -> { try { runWithWorkspace(projectPath, request); } catch (TaskExecutionException ex) { if (ex.getRetryInterval().isPresent()) { if (!ex.getError(cf).isPresent()) { logger.debug("Retrying task {}", ex.toString()); } else { logger.error("Task failed, retrying", ex); } callback.retryTask(request, agentId, ex.getRetryInterval().get(), ex.getStateParams(cf).get(), ex.getError(cf)); } else { if (request.isCancelRequested()) { logger.warn("Task canceled.", request.getTaskName()); } else { logger.error("Task failed.\n{}", request.getTaskName(), formatExceptionMessage(ex)); logger.debug("", ex); } callback.taskFailed(request, agentId, ex.getError(cf).get()); } } catch (RuntimeException | AssertionError ex) { if (ex instanceof ConfigException) { logger.error("Configuration error at task {}: {}", request.getTaskName(), formatExceptionMessage(ex)); } else { logger.error( LogMarkers.UNEXPECTED_SERVER_ERROR, "Task failed with unexpected error: {}", ex.getMessage(), ex); } callback.taskFailed(request, agentId, buildExceptionErrorConfig(ex).toConfig(cf)); } catch (Throwable ex) { logger.error( LogMarkers.UNEXPECTED_SERVER_ERROR, "Task failed with unexpected error: {}", ex.getMessage(), ex); if (request.isCancelRequested()) { logger.warn("This task will be canceled since it's already requested to be canceled"); callback.taskFailed(request, agentId, buildExceptionErrorConfig(ex).toConfig(cf)); } } return true; }); } catch (RuntimeException | IOException ex) { logger.error( LogMarkers.UNEXPECTED_SERVER_ERROR, "Task failed with unexpected error: {}", ex.getMessage(), ex); callback.taskFailed(request, agentId, buildExceptionErrorConfig(ex).toConfig(cf)); } }

Target:
protected void runWithHeartbeat(TaskRequest request) { try { workspaceManager.withExtractedArchive(request, () -> callback.openArchive(request), (projectPath) -> { try { runWithWorkspace(projectPath, request); } catch (TaskExecutionException ex) { if (ex.getRetryInterval().isPresent()) { if (!ex.getError(cf).isPresent()) { logger.debug("Retrying task {}", ex.toString()); } else { logger.error("Task failed, retrying", ex); } callback.retryTask(request, agentId, ex.getRetryInterval().get(), ex.getStateParams(cf).get(), ex.getError(cf)); } else { if (request.isCancelRequested()) { logger.warn("Task is canceled.", request.getTaskName()); } else { logger.error("Task failed.\n{}", request.getTaskName(), formatExceptionMessage(ex)); logger.debug("", ex); } callback.taskFailed(request, agentId, ex.getError(cf).get()); } } catch (RuntimeException | AssertionError ex) { if (ex instanceof ConfigException) { logger.error("Configuration error at task {}: {}", request.getTaskName(), formatExceptionMessage(ex)); } else { logger.error( LogMarkers.UNEXPECTED_SERVER_ERROR, "Task failed with unexpected error: {}", ex.getMessage(), ex); } callback.taskFailed(request, agentId, buildExceptionErrorConfig(ex).toConfig(cf)); } catch (Throwable ex) { logger.error( LogMarkers.UNEXPECTED_SERVER_ERROR, "Task failed with unexpected error: {}", ex.getMessage(), ex); if (request.isCancelRequested()) { logger.warn("This task will be canceled since it's already requested to be canceled"); callback.taskFailed(request, agentId, buildExceptionErrorConfig(ex).toConfig(cf)); } } return true; }); } catch (RuntimeException | IOException ex) { logger.error( LogMarkers.UNEXPECTED_SERVER_ERROR, "Task failed with unexpected error: {}", ex.getMessage(), ex); callback.taskFailed(request, agentId, buildExceptionErrorConfig(ex).toConfig(cf)); } }