cli: improve error handling on editor select call
Use common error functions instead of explicit warn() calls Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
a2fd837e2e
commit
7f0913d7b1
@ -609,19 +609,19 @@ export function edit_create_destroy(info, node)
|
|||||||
select: function(ctx, argv) {
|
select: function(ctx, argv) {
|
||||||
let name = argv[0];
|
let name = argv[0];
|
||||||
if (!name) {
|
if (!name) {
|
||||||
warn(`Missing argument\n`);
|
ctx.missing_argument();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let obj = object_lookup(ctx, this, this.object_name);
|
let obj = object_lookup(ctx, this, this.object_name);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
warn(`Object not found\n`);
|
ctx.invalid_argument("Object not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let entry = obj[name];
|
let entry = obj[name];
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
warn(`${name} not found\n`);
|
ctx.invalid_argument(`${name} not found: %s`, name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user