OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef INCLUDE_DART_API_H_ | 5 #ifndef INCLUDE_DART_API_H_ |
6 #define INCLUDE_DART_API_H_ | 6 #define INCLUDE_DART_API_H_ |
7 | 7 |
8 /** \mainpage Dart Embedding API Reference | 8 /** \mainpage Dart Embedding API Reference |
9 * | 9 * |
10 * Dart is a class-based programming language for creating structured | 10 * Dart is a class-based programming language for creating structured |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 /** | 134 /** |
135 * Produces an error handle with the provided error message. | 135 * Produces an error handle with the provided error message. |
136 * | 136 * |
137 * Requires there to be a current isolate. | 137 * Requires there to be a current isolate. |
138 * | 138 * |
139 * \param error A C string containing an error message. | 139 * \param error A C string containing an error message. |
140 */ | 140 */ |
141 DART_EXPORT Dart_Handle Dart_Error(const char* format, ...); | 141 DART_EXPORT Dart_Handle Dart_Error(const char* format, ...); |
142 | 142 |
| 143 /** |
| 144 * Propagates an error. |
| 145 * |
| 146 * It only makes sense to call this function when there are dart |
| 147 * frames on the stack. That is, this function should only be called |
| 148 * in the C implementation of a native function which has been called |
| 149 * from Dart code. If this function is called in the top-level |
| 150 * embedder code, it will return an error, as there is no way to |
| 151 * further propagate the error. |
| 152 * |
| 153 * The provided handle must be an error handle. (See Dart_IsError.) |
| 154 * |
| 155 * If the provided handle is an unhandled exception, this function |
| 156 * will cause the unhandled exception to be rethrown. Otherwise, the |
| 157 * error will be propagated to the caller, discarding any active dart |
| 158 * frames up to the next C frame. |
| 159 * |
| 160 * \param An error handle. |
| 161 * |
| 162 * \return On success, this function does not return. On failure, an |
| 163 * error handle is returned. |
| 164 */ |
| 165 DART_EXPORT Dart_Handle Dart_PropagateError(Dart_Handle handle); |
| 166 |
143 // Internal routine used for reporting error handles. | 167 // Internal routine used for reporting error handles. |
144 DART_EXPORT void _Dart_ReportErrorHandle(const char* file, | 168 DART_EXPORT void _Dart_ReportErrorHandle(const char* file, |
145 int line, | 169 int line, |
146 const char* handle_string, | 170 const char* handle_string, |
147 const char* error); | 171 const char* error); |
148 | 172 |
149 // TODO(turnidge): Move DART_CHECK_VALID to some sort of dart_utils | 173 // TODO(turnidge): Move DART_CHECK_VALID to some sort of dart_utils |
150 // header instead of this header. | 174 // header instead of this header. |
151 /** | 175 /** |
152 * Aborts the process if 'handle' is an error handle. | 176 * Aborts the process if 'handle' is an error handle. |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 }; | 1461 }; |
1438 | 1462 |
1439 /** | 1463 /** |
1440 * A Dart_CMessage is used for encoding and decoding messages from native code. | 1464 * A Dart_CMessage is used for encoding and decoding messages from native code. |
1441 */ | 1465 */ |
1442 struct Dart_CMessage { | 1466 struct Dart_CMessage { |
1443 Dart_CObject** message; | 1467 Dart_CObject** message; |
1444 }; | 1468 }; |
1445 | 1469 |
1446 #endif // INCLUDE_DART_API_H_ | 1470 #endif // INCLUDE_DART_API_H_ |
OLD | NEW |