Permalink
Browse files

Remove PrintException.

  • Loading branch information...
1 parent c96c1c3 commit df8df36da91f64683d55f741770da88e5b43dd69 @brianmcd committed May 17, 2012
Showing with 3 additions and 48 deletions.
  1. +3 −3 .npmignore
  2. +0 −45 src/contextify.cc
View
6 .npmignore
@@ -1,12 +1,12 @@
Makefile
.lock-wscript
-node_modules/
-build/
+node_modules
+build
*.swp
*.swo
TODO
Makefile.gyp
*.Makefile
*.target.gyp.mk
gyp-mac-tool
-out/
+out
View
45 src/contextify.cc
@@ -124,13 +124,11 @@ class ContextifyContext : ObjectWrap {
}
if (script.IsEmpty()) {
context->Exit();
- PrintException(trycatch);
return trycatch.ReThrow();
}
Handle<Value> result = script->Run();
context->Exit();
if (result.IsEmpty()) {
- PrintException(trycatch);
return trycatch.ReThrow();
}
return scope.Close(result);
@@ -208,49 +206,6 @@ class ContextifyContext : ObjectWrap {
ContextifyContext* ctx = ObjectWrap::Unwrap<ContextifyContext>(data);
return scope.Close(ctx->sandbox->GetPropertyNames());
}
-
- // Mostly taken from d8 shell.
- static void PrintException(TryCatch &try_catch) {
- HandleScope handle_scope;
- String::Utf8Value exception(try_catch.Exception());
- const char* exception_string = ToCString(exception);
- Handle<v8::Message> message = try_catch.Message();
- if (message.IsEmpty()) {
- // V8 didn't provide any extra information about this error; just
- // print the exception.
- fprintf(stderr, "%s\n", exception_string);
- } else {
- // Print (filename):(line number): (message).
- String::Utf8Value filename(message->GetScriptResourceName());
- const char* filename_string = ToCString(filename);
- int linenum = message->GetLineNumber();
- fprintf(stderr, "%s:%i: %s\n", filename_string, linenum, exception_string);
- // Print line of source code.
- String::Utf8Value sourceline(message->GetSourceLine());
- const char* sourceline_string = ToCString(sourceline);
- fprintf(stderr, "%s\n", sourceline_string);
- // Print wavy underline (GetUnderline is deprecated).
- int start = message->GetStartColumn();
- for (int i = 0; i < start; i++) {
- fprintf(stderr, " ");
- }
- int end = message->GetEndColumn();
- for (int i = start; i < end; i++) {
- fprintf(stderr, "^");
- }
- fprintf(stderr, "\n");
- String::Utf8Value stack_trace(try_catch.StackTrace());
- if (stack_trace.length() > 0) {
- const char* stack_trace_string = ToCString(stack_trace);
- fprintf(stderr, "%s\n", stack_trace_string);
- }
- }
- }
-
- // Extracts a C string from a V8 Utf8Value.
- static const char* ToCString(const String::Utf8Value& value) {
- return *value ? *value : "<string conversion failed>";
- }
};
Persistent<FunctionTemplate> ContextifyContext::jsTmpl;

0 comments on commit df8df36

Please sign in to comment.