| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 const UnhandledException& error = UnhandledException::Cast(obj); | 378 const UnhandledException& error = UnhandledException::Cast(obj); |
| 379 return Api::NewHandle(isolate, error.stacktrace()); | 379 return Api::NewHandle(isolate, error.stacktrace()); |
| 380 } else if (obj.IsError()) { | 380 } else if (obj.IsError()) { |
| 381 return Api::NewError("This error is not an unhandled exception error."); | 381 return Api::NewError("This error is not an unhandled exception error."); |
| 382 } else { | 382 } else { |
| 383 return Api::NewError("Can only get stacktraces from error handles."); | 383 return Api::NewError("Can only get stacktraces from error handles."); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 | 387 |
| 388 // Deprecated. | |
| 389 // TODO(turnidge): Remove all uses and delete. | |
| 390 DART_EXPORT Dart_Handle Dart_Error(const char* error) { | |
| 391 return Dart_NewApiError(error); | |
| 392 } | |
| 393 | |
| 394 | |
| 395 // TODO(turnidge): This clones Api::NewError. I need to use va_copy to | 388 // TODO(turnidge): This clones Api::NewError. I need to use va_copy to |
| 396 // fix this but not sure if it available on all of our builds. | 389 // fix this but not sure if it available on all of our builds. |
| 397 DART_EXPORT Dart_Handle Dart_NewApiError(const char* error) { | 390 DART_EXPORT Dart_Handle Dart_NewApiError(const char* error) { |
| 398 Isolate* isolate = Isolate::Current(); | 391 Isolate* isolate = Isolate::Current(); |
| 399 DARTSCOPE(isolate); | 392 DARTSCOPE(isolate); |
| 400 CHECK_CALLBACK_STATE(isolate); | 393 CHECK_CALLBACK_STATE(isolate); |
| 401 | 394 |
| 402 const String& message = String::Handle(isolate, String::New(error)); | 395 const String& message = String::Handle(isolate, String::New(error)); |
| 403 return Api::NewHandle(isolate, ApiError::New(message)); | 396 return Api::NewHandle(isolate, ApiError::New(message)); |
| 404 } | 397 } |
| (...skipping 4004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4409 } | 4402 } |
| 4410 { | 4403 { |
| 4411 NoGCScope no_gc; | 4404 NoGCScope no_gc; |
| 4412 RawObject* raw_obj = obj.raw(); | 4405 RawObject* raw_obj = obj.raw(); |
| 4413 isolate->heap()->SetPeer(raw_obj, peer); | 4406 isolate->heap()->SetPeer(raw_obj, peer); |
| 4414 } | 4407 } |
| 4415 return Api::Success(); | 4408 return Api::Success(); |
| 4416 } | 4409 } |
| 4417 | 4410 |
| 4418 } // namespace dart | 4411 } // namespace dart |
| OLD | NEW |