How to use the error function from cli

Find comprehensive JavaScript cli.error code examples handpicked from public code repositorys.

34
35
36
37
38
39
40
41
42
43
    return func(cli.args);
}

utils.GetAllContainers(host, function (err, containers){
    if (err) {
        return cli.error(err);
    }

    return func(containers);
});
fork icon37
star icon780
watch icon38

+ 11 other calls in file

61
62
63
64
65
66
67
68
69
70
if (cli.options.pattern) {
  let fileName = path.resolve(cli.options.cwd, parseFilePattern(cli.options.pattern, file, cli.options.cwd))

  if (cli.options.rename === true) {
    fs.rename(file, fileName, function(err) {
      if (err) return cli.error(err)

      fs.writeFile(fileName, result, function(err) {
        if (err) return cli.error(err)
        cli.ok(file + ' successfully converted and renamed')
fork icon11
star icon52
watch icon4

+ 19 other calls in file

12
13
14
15
16
17
18
19
20
21
app.parse(process.argv)

// Error check for bad commands
const commandExists = app.commands.some(cmd => cmd._name == app.args[0])
if (app.args[0] && !commandExists) {
  cli.error('That\'s not a command!')
  app.outputHelp()
}

// Setup notifier for updates
fork icon1
star icon3
watch icon3

15
16
17
18
19
20
21
22
23
24

process.on('uncaughtException', function (err) {
  if (err) {
    switch (err.code) {
      case 'EADDRINUSE':
        cli.error('The port is already taken.')
        break
      default:
        cli.error(err)
    }
fork icon6
star icon1
watch icon1

+ 31 other calls in file

24
25
26
27
28
29
30
31
32
33
  }
}

app(config, function(err, info, ok) {
  if (err) {
    cli.error(err);
  } else if (info) {
    cli.info(info);
  } else if (ok) {
    cli.ok(ok);
fork icon34
star icon0
watch icon2

19
20
21
22
23
24
25
26
27
28
});

cli.main(function main (args, options) {

    if (args.length === 0) {
        cli.error('missing FILENAME');
        cli.getUsage();
    }

    AnsiBlit.blit(args[0], options, function (err) {
fork icon0
star icon15
watch icon2

+ 3 other calls in file

9
10
11
12
13
14
15
16
17
        + " --execute \"" + sql + "\"";

exec(cmd, 
  function (error, stdout, stderr) {
    if (error !== null) {
      cli.error('Error when executing:\n' + cmd + '\n' + error);
    }
    callback(stdout, error);
});
fork icon0
star icon7
watch icon4

+ 29 other calls in file

108
109
110
111
112
113
114
115
116
117
return pkgToMd.writeMarkdown(options)
    .then(function (msg) {
        cli.info(msg);
    })
    .catch(function (err) {
        cli.error('////////////////////////////////////////////////////////////////////////////////');
        cli.error(err.stack);
        cli.error('////////////////////////////////////////////////////////////////////////////////');
        cli.getUsage(1);
    });
fork icon0
star icon2
watch icon2

+ 11 other calls in file

179
180
181
182
183
184
185
186
187
188
      process.stdout.write(minified);
    }
  }
  catch (e) {
    status = 4;
    cli.error('Cannot write to output');
  }
}

cli.exit(status);
fork icon601
star icon0
watch icon2

+ 7 other calls in file

18
19
20
21
22
23
24
25
26
27
  , to = options.to
  , dry = options.dry
  ;

if (!to || !from) {
  cli.error('"to" and "from" options are required.\n');
  cli.output(cli.getUsage());
  cli.exit(1);
  return ;
}
fork icon180
star icon0
watch icon11

+ 3 other calls in file

90
91
92
93
94
95
96
97
98
99
// cd into <myApp>
// Update package.json
// npm install

if (args.length !== 1) {
    return Cli.error('Invalid number of arguments' + '\n' +
                     'Usage: babu <myApp>');
}

var Generate = function () {
fork icon0
star icon2
watch icon3

+ 3 other calls in file

69
70
71
72
73
74
75
76
77
            break;
        case 'remove':
            doRemove(cli, options, args);
            break;
        default:
            cli.error("Sorry, not implemented yet.");
            break;
    }
});
fork icon0
star icon0
watch icon12

+ 7 other calls in file

8
9
10
11
12
13
14
15
16
17
mongoose.connection.on('connected', function () {  
  cli.ok('Mongoose default connection open to ' + dbURI);
}); 

mongoose.connection.on('error',function (err) {  
  cli.error('Mongoose default connection error: ' + err);
});

process.on('SIGINT', function() {  
  mongoose.connection.close(function () { 
fork icon0
star icon0
watch icon4

26
27
28
29
30
31
32
33
34
35
request(requestOptions, function (err, data, body) {
    if (err) { throw err; }

    if (data.statusCode !== 200) {
        cli.error('Login Required');
        cli.error('Please use \'stackato login\'');
    } else {
        var apps = JSON.parse(body);
        if (apps.length > 0) {
            console.log(formatApps(JSON.parse(body)));
fork icon0
star icon0
watch icon2

+ 7 other calls in file