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

Unified Diff: runtime/lib/typed_data.cc

Issue 25566002: Factor out throwing of argument error. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/lib/string.cc ('k') | runtime/vm/exceptions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/typed_data.cc
===================================================================
--- runtime/lib/typed_data.cc (revision 28096)
+++ runtime/lib/typed_data.cc (working copy)
@@ -38,9 +38,7 @@
const String& error = String::Handle(String::NewFormatted(
"Length (%" Pd ") of object must be in range [0..%" Pd "]",
len, max));
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, error);
- Exceptions::ThrowByType(Exceptions::kArgument, args);
+ Exceptions::ThrowArgumentError(error);
}
}
@@ -63,9 +61,7 @@
}
const String& error = String::Handle(String::NewFormatted(
"Expected a TypedData object but found %s", instance.ToCString()));
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, error);
- Exceptions::ThrowByType(Exceptions::kArgument, args);
+ Exceptions::ThrowArgumentError(error);
return Integer::null();
}
@@ -107,9 +103,7 @@
if (length.Value() < 0) {
const String& error = String::Handle(String::NewFormatted(
"length (%" Pd ") must be non-negative", length.Value()));
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, error);
- Exceptions::ThrowByType(Exceptions::kArgument, args);
+ Exceptions::ThrowArgumentError(error);
}
if (dst.IsTypedData()) {
if (src.IsTypedData()) {
@@ -193,9 +187,7 @@
} \
const String& error = String::Handle(String::NewFormatted( \
"Expected a TypedData object but found %s", instance.ToCString())); \
- const Array& args = Array::Handle(Array::New(1)); \
- args.SetAt(0, error); \
- Exceptions::ThrowByType(Exceptions::kArgument, args); \
+ Exceptions::ThrowArgumentError(error); \
return object::null(); \
} \
@@ -218,9 +210,7 @@
} else { \
const String& error = String::Handle(String::NewFormatted( \
"Expected a TypedData object but found %s", instance.ToCString())); \
- const Array& args = Array::Handle(Array::New(1)); \
- args.SetAt(0, error); \
- Exceptions::ThrowByType(Exceptions::kArgument, args); \
+ Exceptions::ThrowArgumentError(error); \
} \
return Object::null(); \
}
@@ -242,9 +232,7 @@
} else { \
const String& error = String::Handle(String::NewFormatted( \
"Expected a TypedData object but found %s", instance.ToCString())); \
- const Array& args = Array::Handle(Array::New(1)); \
- args.SetAt(0, error); \
- Exceptions::ThrowByType(Exceptions::kArgument, args); \
+ Exceptions::ThrowArgumentError(error); \
} \
return Integer::NewFromUint64(value); \
} \
@@ -277,9 +265,7 @@
} else { \
const String& error = String::Handle(String::NewFormatted( \
"Expected a TypedData object but found %s", instance.ToCString())); \
- const Array& args = Array::Handle(Array::New(1)); \
- args.SetAt(0, error); \
- Exceptions::ThrowByType(Exceptions::kArgument, args); \
+ Exceptions::ThrowArgumentError(error); \
} \
return Object::null(); \
}
« no previous file with comments | « runtime/lib/string.cc ('k') | runtime/vm/exceptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698