diff mbox series

[ovs-dev,22/23] db-ctl-base: Don't die in cmd_clear() on error.

Message ID 20180702105019.10345-23-jkbs@redhat.com
State Accepted
Headers show
Series Don't use ctl_fatal() in command handlers from db-ctl-base | expand

Commit Message

Jakub Sitnicki July 2, 2018, 10:50 a.m. UTC
Return the error via the context instead of calling ctl_fatal() so that
the caller can decide how to handle it.

Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
---
 lib/db-ctl-base.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
index 585cf67a0..f5492aadb 100644
--- a/lib/db-ctl-base.c
+++ b/lib/db-ctl-base.c
@@ -1661,9 +1661,10 @@  cmd_clear(struct ctl_context *ctx)
 
         type = &column->type;
         if (type->n_min > 0) {
-            ctl_fatal("\"clear\" operation cannot be applied to column %s "
-                      "of table %s, which is not allowed to be empty",
+            ctl_error(ctx, "\"clear\" operation cannot be applied to column "
+                      "%s of table %s, which is not allowed to be empty",
                       column->name, table->name);
+            return;
         }
 
         ovsdb_datum_init_empty(&datum);