Skip to content

Commit 73d5000

Browse files
authored
Print explicit error when using an invalid target (#182)
Closes #87
1 parent 225d9dc commit 73d5000

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bin/httpsnippet

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ cmd.args.forEach(function (fileName) {
5656
})
5757

5858
.then(function (output) {
59+
if (!output) {
60+
var targetNames = HTTPSnippet.availableTargets().map(function (t) { return t.key }).join(', ')
61+
return console.error('%s %s is not a valid target. Valid targets: %s', chalk.red('✖'), chalk.red(cmd.target), chalk.cyan(targetNames))
62+
}
63+
5964
// print
6065
if (!cmd.output) {
6166
return console.log('%s %s > %s [%s] :\n%s', chalk.green('✓'), chalk.cyan.bold(file), chalk.yellow(cmd.target), chalk.yellow(cmd.client ? cmd.client : 'default'), output)

0 commit comments

Comments
 (0)