From 9524c1c248d54309ee41c72e59725487d55291e2 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 14 Oct 2019 13:24:22 +0200 Subject: [PATCH] TT#68300 Fix tool error messages We should not be outputting the usage() text when we get a run-time error, as these are unrelated and depend on the state of the server, not on how it was called. Change-Id: I996d52cf2e4f4a834a281f8d85ea7571f61cf2e4 --- bin/ngcp-create-subscriber | 2 +- bin/ngcp-delete-domain | 4 ++-- bin/ngcp-terminate-subscriber | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/ngcp-create-subscriber b/bin/ngcp-create-subscriber index 418cf20..359f8db 100755 --- a/bin/ngcp-create-subscriber +++ b/bin/ngcp-create-subscriber @@ -69,7 +69,7 @@ sub main { $data{domain_id} = $tmp->{id}; } } else { - usage("Domain not found"); + die "Domain $opts->{domain} not found\n"; } my $res = $client->request("POST", $uri, \%data); print $res->result."\n"; diff --git a/bin/ngcp-delete-domain b/bin/ngcp-delete-domain index 57e2821..61ef76f 100755 --- a/bin/ngcp-delete-domain +++ b/bin/ngcp-delete-domain @@ -62,10 +62,10 @@ sub main { } else { $dom_id = $tmp->{id}; } - usage("Domain not found") unless $dom_id; + die "Domain $opts->{domain} not found\n" unless $dom_id; $uri .= $dom_id; } else { - usage("Domain not found"); + die "Domain $opts->{domain} not found\n"; } my $res = $client->request("DELETE", $uri, \%data); print $res->result."\n"; diff --git a/bin/ngcp-terminate-subscriber b/bin/ngcp-terminate-subscriber index 0978167..9893b07 100755 --- a/bin/ngcp-terminate-subscriber +++ b/bin/ngcp-terminate-subscriber @@ -57,9 +57,9 @@ sub main { } else { $sub_id = $tmp->{id}; } - usage("Wrong subscriber id found") unless $sub_id =~ /^\d$/; + die "Wrong subscriber id $sub_id found\n" unless $sub_id =~ /^\d$/; } else { - usage("Subscriber not found"); + die "Subscriber $opts->{username}\@$opts->{domain} not found\n"; } $uri = '/api/subscribers/'.$sub_id; my $data = [ { op => 'replace',