mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Reuse template array to produce readable list of available templates
This commit is contained in:
parent
f17c81a8c9
commit
00a7290bf2
@ -38,10 +38,13 @@ class Create {
|
||||
'aws-python',
|
||||
];
|
||||
|
||||
const humanReadableTemplateList = `${validTemplates.slice(0, -1)
|
||||
.join(', ')} and ${validTemplates.slice(-1)}`;
|
||||
|
||||
if (validTemplates.indexOf(this.options.template) === -1) {
|
||||
const errorMessage = [
|
||||
`Template "${this.options.template}" is not supported.`,
|
||||
' Supported templates are: "aws-nodejs" and "aws-python".',
|
||||
` Supported templates are: ${humanReadableTemplateList}.`,
|
||||
].join('');
|
||||
throw new this.serverless.classes.Error(errorMessage);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user