blob: 4d2f78f1268704854bfa8cea037848de0ee3d3ef [file] [log] [blame]
// Copyright (c) 2015, 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._runtime;
// We need to set these properties while the sdk is only partially initialized
// so we cannot use regular Dart fields.
// The default values for these properties are set when the global_ final field
// in runtime.dart is initialized.
// Override, e.g., for testing
void trapRuntimeErrors(bool flag) {
JS('', 'dart.__trapRuntimeErrors = #', flag);
}
void ignoreWhitelistedErrors(bool flag) {
JS('', 'dart.__ignoreWhitelistedErrors = #', flag);
}
void ignoreAllErrors(bool flag) {
JS('', 'dart.__ignoreAllErrors = #', flag);
}
argumentError(value) {
if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
throw new ArgumentError.value(value);
}
throwUnimplementedError(String message) {
if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
throw new UnimplementedError(message);
}
assertFailed(message) {
if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
throw new AssertionErrorImpl(message);
}
throwCyclicInitializationError([Object field]) {
if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
throw new CyclicInitializationError(field);
}
throwNullValueError() {
// TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought
// to thread through method info, but that uglifies the code and can't
// actually be queried ... it only affects how the error is printed.
if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
throw new NoSuchMethodError(
null, new Symbol('<Unexpected Null Value>'), null, null, null);
}