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 env list
Implementation
void error(
final String message, {
final Exception? exception,
final String? hint,
final bool newParagraph = false,
final StackTrace? stackTrace,
final 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.info(
hint,
type: cli.TextLogType.hint,
);
}
}