error static method

String error(
  1. String message, {
  2. bool error = true,
  3. int? exitCode,
})

Logs an error message in red. If error is true, the message will be output to stderr. If exitCode is not null, the process will exit with the given exit code.

Implementation

static String error(String message, {bool error = true, int? exitCode}) {
  String output = '{@red}[ERROR] $message{@end}';
  out(output, error: error);

  if (exitCode != null) {
    exit(exitCode);
  }

  // Return for testing.
  return output;
}