message property

String message

Descriptive error message that includes the content-type, encoding, as well as the string or bytes that could not be encoded or decoded, respectively.

Implementation

String get message {
  String description;
  String bodyLine;
  if (body != null) {
    description = 'Body could not be encoded.';
    bodyLine = 'Body: $body';
  } else {
    description = 'Bytes could not be decoded.';
    bodyLine = 'Bytes: $bytes';
  }

  String msg = description;
  final encodingName = encoding?.name ?? 'null';
  msg += '\n\tContent-Type: $contentType';
  msg += '\n\tEncoding: $encodingName';
  msg += '\n\t$bodyLine';

  return msg;
}