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
changes/11/34211/1
Guillem Jover 7 years ago
parent 1e4dd592d5
commit 9524c1c248

@ -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";

@ -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";

@ -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',

Loading…
Cancel
Save