diff mbox series

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

Message ID 20180702105019.10345-24-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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
index f5492aadb..bfec8257a 100644
--- a/lib/db-ctl-base.c
+++ b/lib/db-ctl-base.c
@@ -1785,11 +1785,15 @@  cmd_destroy(struct ctl_context *ctx)
     }
 
     if (delete_all && ctx->argc > 2) {
-        ctl_fatal("--all and records argument should not be specified together");
+        ctl_error(ctx, "--all and records argument should not be specified "
+                  "together");
+        return;
     }
 
     if (delete_all && !must_exist) {
-        ctl_fatal("--all and --if-exists should not be specified together");
+        ctl_error(ctx, "--all and --if-exists should not be specified "
+                  "together");
+        return;
     }
 
     if (delete_all) {