[lxc-devel] [lxd/master] lxd/operations: Improve error message when database insertion fails

freeekanayaka on Github lxc-bot at linuxcontainers.org
Wed May 20 10:30:11 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 387 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200520/bc8d246c/attachment.bin>
-------------- next part --------------
From aaa6a4c9bcff74e314acc83b6bf9f73ebe8b25c0 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Wed, 20 May 2020 11:29:05 +0100
Subject: [PATCH] lxd/operations: Improve error message when database insertion
 fails

Should help with #7393

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/operations/linux.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/operations/linux.go b/lxd/operations/linux.go
index 5c74a33eea..10005a57ec 100644
--- a/lxd/operations/linux.go
+++ b/lxd/operations/linux.go
@@ -18,7 +18,7 @@ func registerDBOperation(op *Operation, opType db.OperationType) error {
 		return err
 	})
 	if err != nil {
-		return errors.Wrapf(err, "failed to add Operation %s to database", op.id)
+		return errors.Wrapf(err, "failed to add %q Operation %s to database", opType.Description(), op.id)
 	}
 
 	return nil


More information about the lxc-devel mailing list