Revision f230a1cf deps/v8/samples/shell.cc

View differences:

deps/v8/samples/shell.cc
140 140
// the argument into a JavaScript string.
141 141
void Read(const v8::FunctionCallbackInfo<v8::Value>& args) {
142 142
  if (args.Length() != 1) {
143
    v8::ThrowException(v8::String::New("Bad parameters"));
143
    args.GetIsolate()->ThrowException(
144
        v8::String::New("Bad parameters"));
144 145
    return;
145 146
  }
146 147
  v8::String::Utf8Value file(args[0]);
147 148
  if (*file == NULL) {
148
    v8::ThrowException(v8::String::New("Error loading file"));
149
    args.GetIsolate()->ThrowException(
150
        v8::String::New("Error loading file"));
149 151
    return;
150 152
  }
151 153
  v8::Handle<v8::String> source = ReadFile(*file);
152 154
  if (source.IsEmpty()) {
153
    v8::ThrowException(v8::String::New("Error loading file"));
155
    args.GetIsolate()->ThrowException(
156
        v8::String::New("Error loading file"));
154 157
    return;
155 158
  }
156 159
  args.GetReturnValue().Set(source);
......
165 168
    v8::HandleScope handle_scope(args.GetIsolate());
166 169
    v8::String::Utf8Value file(args[i]);
167 170
    if (*file == NULL) {
168
      v8::ThrowException(v8::String::New("Error loading file"));
171
      args.GetIsolate()->ThrowException(
172
          v8::String::New("Error loading file"));
169 173
      return;
170 174
    }
171 175
    v8::Handle<v8::String> source = ReadFile(*file);
172 176
    if (source.IsEmpty()) {
173
      v8::ThrowException(v8::String::New("Error loading file"));
177
      args.GetIsolate()->ThrowException(
178
           v8::String::New("Error loading file"));
174 179
      return;
175 180
    }
176 181
    if (!ExecuteString(args.GetIsolate(),
......
178 183
                       v8::String::New(*file),
179 184
                       false,
180 185
                       false)) {
181
      v8::ThrowException(v8::String::New("Error executing file"));
186
      args.GetIsolate()->ThrowException(
187
          v8::String::New("Error executing file"));
182 188
      return;
183 189
    }
184 190
  }

Also available in: Unified diff