da2bf9
From 8cb38e1557b81740f49dff43a297aef7bd676424 Mon Sep 17 00:00:00 2001
da2bf9
From: Lennart Poettering <lennart@poettering.net>
da2bf9
Date: Tue, 9 Oct 2018 22:22:52 +0200
da2bf9
Subject: [PATCH] core: make destructive transaction error a bit more useful
da2bf9
da2bf9
(cherry picked from commit cf99f8eacf1c864b19a6a02edea78c43f3185cb7)
da2bf9
da2bf9
Related: #2040147
da2bf9
---
da2bf9
 src/core/transaction.c | 4 +++-
da2bf9
 1 file changed, 3 insertions(+), 1 deletion(-)
da2bf9
da2bf9
diff --git a/src/core/transaction.c b/src/core/transaction.c
da2bf9
index cdaaff4f55..ee5b39fef4 100644
da2bf9
--- a/src/core/transaction.c
da2bf9
+++ b/src/core/transaction.c
da2bf9
@@ -526,7 +526,9 @@ static int transaction_is_destructive(Transaction *tr, JobMode mode, sd_bus_erro
da2bf9
                 if (j->unit->job && (mode == JOB_FAIL || j->unit->job->irreversible) &&
da2bf9
                     job_type_is_conflicting(j->unit->job->type, j->type))
da2bf9
                         return sd_bus_error_setf(e, BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE,
da2bf9
-                                                 "Transaction is destructive.");
da2bf9
+                                                 "Transaction for %s/%s is destructive (%s has '%s' job queued, but '%s' is included in transaction).",
da2bf9
+                                                 tr->anchor_job->unit->id, job_type_to_string(tr->anchor_job->type),
da2bf9
+                                                 j->unit->id, job_type_to_string(j->unit->job->type), job_type_to_string(j->type));
da2bf9
         }
da2bf9
 
da2bf9
         return 0;