error method
void
error(})
Error Messages Guidelines
Tone: Polite and encouraging, never accusatory. Format:
ERROR: <Short description>
<Actionable suggestion/hint>
Example:
ERROR: Could not update the environment variable.
The variable does not exist, double check the name by running the list command:
$ scloud variable list
Implementation
void error(
String message, {
Exception? exception,
String? hint,
bool newParagraph = false,
StackTrace? stackTrace,
bool forcePrintStackTrace = false,
}) {
final String msg;
if (exception != null) {
final separator = isPunctuation(message[message.length - 1]) ? ' ' : ': ';
final eMessage = userFriendlyExceptionMessage(exception);
final suffix = isPunctuation(eMessage[eMessage.length - 1]) ? '' : '.';
msg = '$message$separator$eMessage$suffix';
} else {
msg = message;
}
_logger.error(
msg,
newParagraph: newParagraph,
stackTrace: configuration?.verbose == true || forcePrintStackTrace
? stackTrace
: null,
);
if (hint != null) {
_logger.log(hint, cli.LogLevel.error, type: cli.TextLogType.hint);
}
}