OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /* | |
6 * This library encapsulates the core sdk errors that the runtime knows about. | |
7 * | |
8 */ | |
9 | |
10 dart_library.library('dart/_errors', null, /* Imports */[ | 1 dart_library.library('dart/_errors', null, /* Imports */[ |
11 ], /* Lazy Imports */[ | 2 ], /* Lazy imports */[ |
12 'dart/_operations', | 3 'dart/_operations', |
13 'dart/core', | 4 'dart/core', |
14 'dart/_js_helper' | 5 'dart/_js_helper' |
15 ], function(exports, operations, core, _js_helper) { | 6 ], function(exports, _operations, core, _js_helper) { |
16 'use strict'; | 7 'use strict'; |
17 | |
18 function throwNoSuchMethod(obj, name, pArgs, nArgs, extras) { | 8 function throwNoSuchMethod(obj, name, pArgs, nArgs, extras) { |
19 operations.throw(new core.NoSuchMethodError(obj, name, pArgs, nArgs, extras)
); | 9 _operations.throw(new core.NoSuchMethodError(obj, name, pArgs, nArgs, extras
)); |
20 } | 10 } |
| 11 function throwCastError(actual, type) { |
| 12 _operations.throw(new _js_helper.CastErrorImplementation(actual, type)); |
| 13 } |
| 14 function throwAssertionError() { |
| 15 _operations.throw(new core.AssertionError()); |
| 16 } |
| 17 function throwNullValueError() { |
| 18 _operations.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpec
ted Null Value>'), null, null, null)); |
| 19 } |
| 20 // Exports: |
21 exports.throwNoSuchMethod = throwNoSuchMethod; | 21 exports.throwNoSuchMethod = throwNoSuchMethod; |
22 | |
23 function throwCastError(actual, type) { | |
24 operations.throw(new _js_helper.CastErrorImplementation(actual, type)); | |
25 } | |
26 exports.throwCastError = throwCastError; | 22 exports.throwCastError = throwCastError; |
27 | |
28 function throwAssertionError() { | |
29 operations.throw(new core.AssertionError()); | |
30 } | |
31 exports.throwAssertionError = throwAssertionError; | 23 exports.throwAssertionError = throwAssertionError; |
32 | |
33 function throwNullValueError() { | |
34 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought | |
35 // to thread through method info, but that uglifies the code and can't | |
36 // actually be queried ... it only affects how the error is printed. | |
37 operations.throw(new core.NoSuchMethodError(null, | |
38 new core.Symbol('<Unexpected Null Value>'), null, null, null)); | |
39 } | |
40 exports.throwNullValueError = throwNullValueError; | 24 exports.throwNullValueError = throwNullValueError; |
41 }); | 25 }); |
OLD | NEW |