How to use the buntstift.buntstift.error function in buntstift

To help you get started, we’ve selected a few buntstift examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thenativeweb / roboter / lib / bin / roboter.js View on Github external
} catch (ex) {
    if (packageJsonOfModule && packageJsonOfModule.scripts && packageJsonOfModule.scripts[ex.command]) {
      const args = process.argv.splice(3);

      try {
        await runCommand(inlineLists`npm run ${ex.command} ${args}`, { cwd });
      } catch (exRunCommand) {
        exit(exRunCommand);
      }

      exit();
    }

    const suggestions = findSuggestions({ for: ex.command, in: validCommands });

    buntstift.error(`Unknown command '${ex.command}', did you mean '${suggestions[0].suggestion}'?`);
    buntstift.exit(1);
  }

  if (!parsed.command) {
    parsed.command = defaultCommand;

    if (parsed.argv.length > 0) {
      if (parsed.argv.includes('--version') || parsed.argv.includes('-v')) {
        buntstift.info(packageJson.version);
        buntstift.exit(0);
      }

      if (parsed.argv.includes('--help') || parsed.argv.includes('-h')) {
        parsed.command = 'help';
      }
    }
github thenativeweb / roboter / lib / cli / ui / printTaskFailure.js View on Github external
const printTaskFailure = function (reason) {
  if (!reason) {
    throw new Error('Reason is missing.');
  }

  buntstift.error(reason);
};
github thenativeweb / roboter / lib / cli / ui / error.js View on Github external
const error = function (err) {
  if (!err) {
    throw new Error('Error is missing.');
  }

  buntstift.error(err);
};
github thenativeweb / roboter / lib / cli / ui / handleException.js View on Github external
const handleException = function (ex, messages) {
  if (!ex) {
    throw new Error('Exception is missing.');
  }
  if (!messages) {
    throw new Error('Messages are missing.');
  }

  let message = messages[ex.code];

  if (!message && messages.default) {
    message = messages.default;
  }

  buntstift.error(message);
};