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/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 const String& message = String::Handle(isolate, String::New(error)); | 807 const String& message = String::Handle(isolate, String::New(error)); |
808 return Api::NewHandle(isolate, ApiError::New(message)); | 808 return Api::NewHandle(isolate, ApiError::New(message)); |
809 } | 809 } |
810 | 810 |
811 | 811 |
812 DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception) { | 812 DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception) { |
813 Isolate* isolate = Isolate::Current(); | 813 Isolate* isolate = Isolate::Current(); |
814 DARTSCOPE(isolate); | 814 DARTSCOPE(isolate); |
815 CHECK_CALLBACK_STATE(isolate); | 815 CHECK_CALLBACK_STATE(isolate); |
816 | 816 |
817 const Instance& obj = Api::UnwrapInstanceHandle(isolate, exception); | 817 Instance& obj = Instance::Handle(isolate); |
818 if (obj.IsNull()) { | 818 if (Dart_IsApiError(exception) || Dart_IsCompilationError(exception)) { |
819 RETURN_TYPE_ERROR(isolate, exception, Instance); | 819 obj = String::New(Dart_GetError(exception)); |
| 820 } else { |
| 821 obj = Api::UnwrapInstanceHandle(isolate, exception).raw(); |
| 822 if (obj.IsNull()) { |
| 823 RETURN_TYPE_ERROR(isolate, exception, Instance); |
| 824 } |
820 } | 825 } |
821 const Stacktrace& stacktrace = Stacktrace::Handle(isolate); | 826 const Stacktrace& stacktrace = Stacktrace::Handle(isolate); |
822 return Api::NewHandle(isolate, UnhandledException::New(obj, stacktrace)); | 827 return Api::NewHandle(isolate, UnhandledException::New(obj, stacktrace)); |
823 } | 828 } |
824 | 829 |
825 | 830 |
826 DART_EXPORT Dart_Handle Dart_PropagateError(Dart_Handle handle) { | 831 DART_EXPORT Dart_Handle Dart_PropagateError(Dart_Handle handle) { |
827 Isolate* isolate = Isolate::Current(); | 832 Isolate* isolate = Isolate::Current(); |
828 { | 833 { |
829 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | 834 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
(...skipping 4951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5781 ASSERT(stream != NULL); | 5786 ASSERT(stream != NULL); |
5782 TimelineEvent* event = stream->StartEvent(); | 5787 TimelineEvent* event = stream->StartEvent(); |
5783 if (event != NULL) { | 5788 if (event != NULL) { |
5784 event->AsyncEnd(label, async_id); | 5789 event->AsyncEnd(label, async_id); |
5785 event->Complete(); | 5790 event->Complete(); |
5786 } | 5791 } |
5787 return Api::Success(); | 5792 return Api::Success(); |
5788 } | 5793 } |
5789 | 5794 |
5790 } // namespace dart | 5795 } // namespace dart |
OLD | NEW |