| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 * | 7 * |
| 8 */ | 8 */ |
| 9 #include "Global.h" | 9 #include "Global.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 HandleScope handleScope(fIsolate); | 34 HandleScope handleScope(fIsolate); |
| 35 String::Utf8Value exception(tryCatch->Exception()); | 35 String::Utf8Value exception(tryCatch->Exception()); |
| 36 const char* exceptionString = to_cstring(exception); | 36 const char* exceptionString = to_cstring(exception); |
| 37 Handle<Message> message = tryCatch->Message(); | 37 Handle<Message> message = tryCatch->Message(); |
| 38 if (message.IsEmpty()) { | 38 if (message.IsEmpty()) { |
| 39 // V8 didn't provide any extra information about this error; just | 39 // V8 didn't provide any extra information about this error; just |
| 40 // print the exception. | 40 // print the exception. |
| 41 fprintf(stderr, "%s\n", exceptionString); | 41 fprintf(stderr, "%s\n", exceptionString); |
| 42 } else { | 42 } else { |
| 43 // Print (filename):(line number): (message). | 43 // Print (filename):(line number): (message). |
| 44 String::Utf8Value filename(message->GetScriptResourceName()); | 44 String::Utf8Value filename(message->GetScriptOrigin().ResourceName()); |
| 45 const char* filenameString = to_cstring(filename); | 45 const char* filenameString = to_cstring(filename); |
| 46 int linenum = message->GetLineNumber(); | 46 int linenum = message->GetLineNumber(); |
| 47 fprintf(stderr, | 47 fprintf(stderr, |
| 48 "%s:%i: %s\n", filenameString, linenum, exceptionString); | 48 "%s:%i: %s\n", filenameString, linenum, exceptionString); |
| 49 // Print line of source code. | 49 // Print line of source code. |
| 50 String::Utf8Value sourceline(message->GetSourceLine()); | 50 String::Utf8Value sourceline(message->GetSourceLine()); |
| 51 const char* sourceLineString = to_cstring(sourceline); | 51 const char* sourceLineString = to_cstring(sourceline); |
| 52 fprintf(stderr, "%s\n", sourceLineString); | 52 fprintf(stderr, "%s\n", sourceLineString); |
| 53 // Print wavy underline. | 53 // Print wavy underline. |
| 54 int start = message->GetStartColumn(); | 54 int start = message->GetStartColumn(); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // Handle any exceptions or output. | 236 // Handle any exceptions or output. |
| 237 if (result.IsEmpty()) { | 237 if (result.IsEmpty()) { |
| 238 SkASSERT(tryCatch.HasCaught()); | 238 SkASSERT(tryCatch.HasCaught()); |
| 239 // Print errors that happened during execution. | 239 // Print errors that happened during execution. |
| 240 this->reportException(&tryCatch); | 240 this->reportException(&tryCatch); |
| 241 return false; | 241 return false; |
| 242 } | 242 } |
| 243 | 243 |
| 244 return true; | 244 return true; |
| 245 } | 245 } |
| OLD | NEW |