Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/exceptions.h" | 5 #include "vm/exceptions.h" |
| 6 | 6 |
| 7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 } | 660 } |
| 661 | 661 |
| 662 | 662 |
| 663 void Exceptions::ThrowArgumentError(const Instance& arg) { | 663 void Exceptions::ThrowArgumentError(const Instance& arg) { |
| 664 const Array& args = Array::Handle(Array::New(1)); | 664 const Array& args = Array::Handle(Array::New(1)); |
| 665 args.SetAt(0, arg); | 665 args.SetAt(0, arg); |
| 666 Exceptions::ThrowByType(Exceptions::kArgument, args); | 666 Exceptions::ThrowByType(Exceptions::kArgument, args); |
| 667 } | 667 } |
| 668 | 668 |
| 669 | 669 |
| 670 void Exceptions::ThrowRangeError(const Instance& arg) { | |
| 671 const Array& args = Array::Handle(Array::New(1)); | |
| 672 args.SetAt(0, arg); | |
| 673 Exceptions::ThrowByType(Exceptions::kRange, args); | |
|
Ivan Posva
2014/09/02 15:27:07
It would be helpful to give the expected range her
Vyacheslav Egorov (Google)
2014/09/02 16:02:53
Alternatively I can just format a string like we d
| |
| 674 } | |
| 675 | |
| 676 | |
| 670 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { | 677 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { |
| 671 Library& library = Library::Handle(); | 678 Library& library = Library::Handle(); |
| 672 const String* class_name = NULL; | 679 const String* class_name = NULL; |
| 673 const String* constructor_name = &Symbols::Dot(); | 680 const String* constructor_name = &Symbols::Dot(); |
| 674 switch (type) { | 681 switch (type) { |
| 675 case kNone: | 682 case kNone: |
| 676 case kStackOverflow: | 683 case kStackOverflow: |
| 677 case kOutOfMemory: | 684 case kOutOfMemory: |
| 678 UNREACHABLE(); | 685 UNREACHABLE(); |
| 679 break; | 686 break; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 761 | 768 |
| 762 // Throw JavascriptCompatibilityError exception. | 769 // Throw JavascriptCompatibilityError exception. |
| 763 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { | 770 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { |
| 764 const Array& exc_args = Array::Handle(Array::New(1)); | 771 const Array& exc_args = Array::Handle(Array::New(1)); |
| 765 const String& msg_str = String::Handle(String::New(msg)); | 772 const String& msg_str = String::Handle(String::New(msg)); |
| 766 exc_args.SetAt(0, msg_str); | 773 exc_args.SetAt(0, msg_str); |
| 767 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); | 774 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); |
| 768 } | 775 } |
| 769 | 776 |
| 770 } // namespace dart | 777 } // namespace dart |
| OLD | NEW |