Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: runtime/vm/exceptions.cc

Issue 533483003: Cleanup throwing of the RangeError in the runtime to remove duplicated code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/exceptions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/exceptions.cc
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 96b498482933e14e56d3cca176b40bcdcdeb0600..9f53b58df90e36ed955d1c9a4deb4194d50897f7 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -667,6 +667,23 @@ void Exceptions::ThrowArgumentError(const Instance& arg) {
}
+void Exceptions::ThrowRangeError(const char* argument_name,
+ const Integer& argument_value,
+ intptr_t expected_from,
+ intptr_t expected_to) {
+ const String& error = String::Handle(String::NewFormatted(
+ "%s (%s) must be in the range [%" Pd "..%" Pd ")",
+ argument_name,
+ argument_value.ToCString(),
+ expected_from,
+ expected_to));
+
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, error);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
+}
+
+
RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
Library& library = Library::Handle();
const String* class_name = NULL;
« no previous file with comments | « runtime/vm/exceptions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698