blob: ac95f2af00c5df4a33818daba069c4c08ec39200 [file] [log] [blame]
// Copyright (c) 2012, 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.
part of dart.async;
_invokeErrorHandler(
Function errorHandler, Object error, StackTrace stackTrace) {
if (errorHandler is ZoneBinaryCallback) {
return errorHandler(error, stackTrace);
} else {
ZoneUnaryCallback unaryErrorHandler = errorHandler;
return unaryErrorHandler(error);
}
}
Function _registerErrorHandler<R>(Function errorHandler, Zone zone) {
if (errorHandler is ZoneBinaryCallback<R, Object, StackTrace>) {
return zone.registerBinaryCallback<R, Object, StackTrace>(
errorHandler);
} else {
return zone.registerUnaryCallback<R, Object>(
errorHandler as ZoneUnaryCallback<R, Object>);
}
}