diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/publishers/DatadogQueuePublisher.java b/src/main/java/org/datadog/jenkins/plugins/datadog/publishers/DatadogQueuePublisher.java index baa8da61..8db502f0 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/publishers/DatadogQueuePublisher.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/publishers/DatadogQueuePublisher.java @@ -147,11 +147,16 @@ private static String getJobName(Task task) { WorkflowJob workflowJob = (WorkflowJob) task; return workflowJob.getFullName(); } - if (task != null) { - logger.info(String.format("Unknown job found: %s, %s", task.getDisplayName(), task.getUrl())); - } else { - logger.info(String.format("Null task found")); + try { + if (task != null) { + logger.info(String.format("Unknown job found: %s, %s", task.getDisplayName(), task.getUrl())); + } else { + logger.info("Null task found"); + } + } + catch (Exception e) { + logger.info("Failed to collect unknown job name"); } return "unknown"; }