| 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 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 Dart_Handle DartUtils::NewDartOSError(OSError* os_error) { | 753 Dart_Handle DartUtils::NewDartOSError(OSError* os_error) { |
| 754 // Create a dart:io OSError object with the information retrieved from the OS. | 754 // Create a dart:io OSError object with the information retrieved from the OS. |
| 755 Dart_Handle clazz = GetDartClass(kIOLibURL, "OSError"); | 755 Dart_Handle clazz = GetDartClass(kIOLibURL, "OSError"); |
| 756 Dart_Handle args[2]; | 756 Dart_Handle args[2]; |
| 757 args[0] = NewString(os_error->message()); | 757 args[0] = NewString(os_error->message()); |
| 758 args[1] = Dart_NewInteger(os_error->code()); | 758 args[1] = Dart_NewInteger(os_error->code()); |
| 759 return Dart_New(clazz, Dart_Null(), 2, args); | 759 return Dart_New(clazz, Dart_Null(), 2, args); |
| 760 } | 760 } |
| 761 | 761 |
| 762 | 762 |
| 763 Dart_Handle DartUtils::NewDartSocketIOException(const char* message, | 763 Dart_Handle DartUtils::NewDartSocketException(const char* message, |
| 764 Dart_Handle os_error) { | 764 Dart_Handle os_error) { |
| 765 // Create a dart:io SocketIOException object. | 765 // Create a dart:io SocketException object. |
| 766 Dart_Handle clazz = GetDartClass(kIOLibURL, "SocketIOException"); | 766 Dart_Handle clazz = GetDartClass(kIOLibURL, "SocketException"); |
| 767 Dart_Handle args[2]; | 767 Dart_Handle args[2]; |
| 768 args[0] = NewString(message); | 768 args[0] = NewString(message); |
| 769 args[1] = os_error; | 769 args[1] = os_error; |
| 770 return Dart_New(clazz, Dart_Null(), 2, args); | 770 return Dart_New(clazz, Dart_Null(), 2, args); |
| 771 } | 771 } |
| 772 | 772 |
| 773 | 773 |
| 774 Dart_Handle DartUtils::NewDartExceptionWithMessage(const char* library_url, | 774 Dart_Handle DartUtils::NewDartExceptionWithMessage(const char* library_url, |
| 775 const char* exception_name, | 775 const char* exception_name, |
| 776 const char* message) { | 776 const char* message) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 new CObjectString(CObject::NewString(os_error->message())); | 957 new CObjectString(CObject::NewString(os_error->message())); |
| 958 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 958 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 959 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 959 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 960 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 960 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 961 result->SetAt(2, error_message); | 961 result->SetAt(2, error_message); |
| 962 return result; | 962 return result; |
| 963 } | 963 } |
| 964 | 964 |
| 965 } // namespace bin | 965 } // namespace bin |
| 966 } // namespace dart | 966 } // namespace dart |
| OLD | NEW |