toString method

  1. @override
String toString()
override

String representation of the exception.

Implementation

@override
String toString() {
  var message = 'exception ${exception.runtimeType}: $exception';

  final e = exception;
  if (e is SocketException) {
    if (e.message.isEmpty) {
      final ose = e.osError;
      if (ose != null) {
        if (ose.errorCode == 61 && ose.message == 'Connection refused') {
          // Known situation: use a more compact error message
          message = 'cannot connect';
        }
      }
    }
  }

  return 'proxy: $message: $targetUri';
}