added parameter type choice error

This commit is contained in:
mmacierzanka committed 2021-08-27 14:32:14 +02:00
1 parent a8efeae9cc
commit 2537261e80
2 files changed
+7 -1

No files matched your search

+1 -1
View File
@@ -148,7 +148,7 @@ export class Command {
name: p.name,
description: p.description || "No description",
required: !p.optional,
type: type,
type: p.choices ? 3 : type,
choices:
p.choices?.map((c) => {
return { name: c, value: c };
+6
View File
@@ -64,6 +64,12 @@ export class CommandManager {
ar.splice(i, 1);
}
});
command.parameters &&
command.parameters.map((p) => {
if (p.type != "string" && p.choices) {
throw new Error('Parameter with defined choices must have a "string" type');
}
});
this.list.push(command);
return true;
} catch (e) {