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

Side by Side Diff: src/d8.cc

Issue 7754018: Better error messages for d8's load() (execute from file). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 for (int i = 0; i < args.Length(); i++) { 264 for (int i = 0; i < args.Length(); i++) {
265 HandleScope handle_scope; 265 HandleScope handle_scope;
266 String::Utf8Value file(args[i]); 266 String::Utf8Value file(args[i]);
267 if (*file == NULL) { 267 if (*file == NULL) {
268 return ThrowException(String::New("Error loading file")); 268 return ThrowException(String::New("Error loading file"));
269 } 269 }
270 Handle<String> source = ReadFile(*file); 270 Handle<String> source = ReadFile(*file);
271 if (source.IsEmpty()) { 271 if (source.IsEmpty()) {
272 return ThrowException(String::New("Error loading file")); 272 return ThrowException(String::New("Error loading file"));
273 } 273 }
274 if (!ExecuteString(source, String::New(*file), false, false)) { 274 if (!ExecuteString(source, String::New(*file), false, true)) {
275 return ThrowException(String::New("Error executing file")); 275 return ThrowException(String::New("Error executing file"));
276 } 276 }
277 } 277 }
278 return Undefined(); 278 return Undefined();
279 } 279 }
280 280
281 281
282 Handle<Value> Shell::CreateExternalArray(const Arguments& args, 282 Handle<Value> Shell::CreateExternalArray(const Arguments& args,
283 ExternalArrayType type, 283 ExternalArrayType type,
284 size_t element_size) { 284 size_t element_size) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 for (int i = start; i < end; i++) { 432 for (int i = start; i < end; i++) {
433 printf("^"); 433 printf("^");
434 } 434 }
435 printf("\n"); 435 printf("\n");
436 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); 436 v8::String::Utf8Value stack_trace(try_catch->StackTrace());
437 if (stack_trace.length() > 0) { 437 if (stack_trace.length() > 0) {
438 const char* stack_trace_string = ToCString(stack_trace); 438 const char* stack_trace_string = ToCString(stack_trace);
439 printf("%s\n", stack_trace_string); 439 printf("%s\n", stack_trace_string);
440 } 440 }
441 } 441 }
442 printf("\n");
442 } 443 }
443 444
444 445
445 #ifndef V8_SHARED 446 #ifndef V8_SHARED
446 Handle<Array> Shell::GetCompletions(Handle<String> text, Handle<String> full) { 447 Handle<Array> Shell::GetCompletions(Handle<String> text, Handle<String> full) {
447 HandleScope handle_scope; 448 HandleScope handle_scope;
448 Context::Scope context_scope(utility_context_); 449 Context::Scope context_scope(utility_context_);
449 Handle<Object> global = utility_context_->Global(); 450 Handle<Object> global = utility_context_->Global();
450 Handle<Value> fun = global->Get(String::New("GetCompletions")); 451 Handle<Value> fun = global->Get(String::New("GetCompletions"));
451 static const int kArgc = 3; 452 static const int kArgc = 3;
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 } 1314 }
1314 1315
1315 } // namespace v8 1316 } // namespace v8
1316 1317
1317 1318
1318 #ifndef GOOGLE3 1319 #ifndef GOOGLE3
1319 int main(int argc, char* argv[]) { 1320 int main(int argc, char* argv[]) {
1320 return v8::Shell::Main(argc, argv); 1321 return v8::Shell::Main(argc, argv);
1321 } 1322 }
1322 #endif 1323 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698