bd4a6291e5
This is follow-up to 52aa8508f1.
TEST=socket_connect_stacktrace_test
Change-Id: I46eafa4852bed92eaf1a9035bcb3b007d700fc0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203280
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
34 lines
910 B
Dart
34 lines
910 B
Dart
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
//
|
|
// Tests stack trace on socket exceptions.
|
|
|
|
import "dart:async";
|
|
import "dart:io";
|
|
|
|
import "package:async_helper/async_helper.dart";
|
|
import "package:expect/expect.dart";
|
|
|
|
import 'dart:io';
|
|
|
|
Future<void> main() async {
|
|
asyncStart();
|
|
|
|
// Test stacktrace when lookup fails
|
|
try {
|
|
await WebSocket.connect('ws://localhost.tld:0/ws');
|
|
} catch (err, stackTrace) {
|
|
Expect.contains('Failed host lookup', err.toString());
|
|
Expect.contains("main ", stackTrace.toString());
|
|
}
|
|
|
|
// Test stacktrace when connection fails
|
|
try {
|
|
await WebSocket.connect('ws://localhost:0/ws');
|
|
} catch (err, stackTrace) {
|
|
Expect.contains("main ", stackTrace.toString());
|
|
}
|
|
asyncEnd();
|
|
}
|