Migrate V8SQLResultSetRowListCustom to ExceptionState.
BUG=270033
Review URL: https://codereview.chromium.org/177323003
git-svn-id: svn://svn.chromium.org/blink/trunk@168116 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
index b2343b8..c3f90de 100644
--- a/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
+++ b/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
@@ -31,20 +31,26 @@
#include "config.h"
#include "V8SQLResultSetRowList.h"
+#include "bindings/v8/ExceptionMessages.h"
+#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8Binding.h"
+#include "core/dom/ExceptionCode.h"
#include "modules/webdatabase/SQLResultSetRowList.h"
namespace WebCore {
void V8SQLResultSetRowList::itemMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "SQLResultSetRowList", info.Holder(), info.GetIsolate());
if (!info.Length()) {
- throwError(v8SyntaxError, "Item index is required.", info.GetIsolate());
+ exceptionState.throwDOMException(SyntaxError, ExceptionMessages::notEnoughArguments(1, 0));
+ exceptionState.throwIfNeeded();
return;
}
if (!info[0]->IsNumber()) {
- throwTypeError("Item index must be a number.", info.GetIsolate());
+ exceptionState.throwTypeError("The index provided is not a number.");
+ exceptionState.throwIfNeeded();
return;
}
@@ -52,7 +58,8 @@
unsigned long index = info[0]->IntegerValue();
if (index >= rowList->length()) {
- throwError(v8RangeError, "Item index is out of range.", info.GetIsolate());
+ exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::indexExceedsMaximumBound<unsigned>("index", index, rowList->length()));
+ exceptionState.throwIfNeeded();
return;
}