mirror of
https://github.com/openwrt/openwrt.git
synced 2025-03-14 00:06:46 +00:00
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) {
|
||||
let name = argv[0];
|
||||
if (!name) {
|
||||
warn(`Missing argument\n`);
|
||||
ctx.missing_argument();
|
||||
return;
|
||||
}
|
||||
|
||||
let obj = object_lookup(ctx, this, this.object_name);
|
||||
if (!obj) {
|
||||
warn(`Object not found\n`);
|
||||
ctx.invalid_argument("Object not found");
|
||||
return;
|
||||
}
|
||||
|
||||
let entry = obj[name];
|
||||
if (!entry) {
|
||||
warn(`${name} not found\n`);
|
||||
ctx.invalid_argument(`${name} not found: %s`, name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user