blob: 452e4b72f6c03ea888d212b9eef054b1f0bfe759 [file] [log] [blame]
// Copyright (c) 2016, 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 file.
library testing.error_handling;
import 'dart:async' show Future;
import 'dart:io' show exitCode, stderr;
import 'dart:isolate' show ReceivePort;
import 'log.dart';
Future<T> withErrorHandling<T>(Future<T> f(), {Logger logger}) async {
final ReceivePort port = new ReceivePort();
try {
return await f();
} catch (e, trace) {
exitCode = 1;
if (trace != null) {
logger?.noticeFrameworkCatchError(e, trace);
return null;
} finally {