describeThrowable function

String describeThrowable(
  1. Object? error
)

Footer-safe rendering of error: its runtime type, then its credential-scrubbed message clipped to kMaxDetailLength.

Never returns an empty string — a footer that says harness_error must always say WHY, including when nothing was recorded.

Implementation

String describeThrowable(Object? error) {
  if (error == null) return 'unclassified: no exception recorded';
  final String message = scrubCredentials(error.toString());
  final String clipped = message.length > kMaxDetailLength
      ? '${message.substring(0, kMaxDetailLength)}…'
      : message;
  return '${error.runtimeType}: $clipped';
}