handleSocketException static method

void handleSocketException(
  1. SocketException ex,
  2. StackTrace stackTrace
)

Implementation

static void handleSocketException(SocketException ex, StackTrace stackTrace) {
  final StringBuffer sb = StringBuffer();
  sb.write('SocketException');
  if (ex.message.isNotEmpty) {
    sb.write(': ${ex.message}');
    if (ex.osError != null) {
      sb.write(' (${ex.osError})');
    }
  } else if (ex.osError != null) {
    sb.write(': ${ex.osError}');
  }
  if (ex.address != null) {
    sb.write(', address = ${ex.address!.host}');
  }

  throw ApiException.fromApiExceptionType(
      ApiExceptionType.clientError, '103');
}