summaryrefslogtreecommitdiffstats
path: root/gin/try_catch.cc
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 17:09:36 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 17:09:36 +0000
commit855ab43da4bd0342e2b8c9592b52ef80ac0b773f (patch)
tree0ea5aa300191aa3e0145fe083015b880edcaed53 /gin/try_catch.cc
parenta29e465aecb6cfc30b757d31242b06eb39846f2a (diff)
downloadchromium_src-855ab43da4bd0342e2b8c9592b52ef80ac0b773f.zip
chromium_src-855ab43da4bd0342e2b8c9592b52ef80ac0b773f.tar.gz
chromium_src-855ab43da4bd0342e2b8c9592b52ef80ac0b773f.tar.bz2
Introduce gin_shell
This CL adds a simple shell program for Gin to make edit/test/debug cycle faster. The shell excutes a list of scripts from the command line and loads any requested AMD modules relative to the current working directory. This CL will also let us remove the ugly code in https://codereview.chromium.org/69843003/diff/240001/mojo/public/bindings/js/test/run_js_tests.cc because we now know how to file modules via the file system. Eventually for Mojo, we'll want to use a net_module_provider (instead of the file_module_provider included in this CL) to load additional AMD modules off the network. BUG=317398 R=jochen@chromium.org Review URL: https://codereview.chromium.org/74753002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235750 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin/try_catch.cc')
-rw-r--r--gin/try_catch.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/gin/try_catch.cc b/gin/try_catch.cc
new file mode 100644
index 0000000..302d8bd
--- /dev/null
+++ b/gin/try_catch.cc
@@ -0,0 +1,32 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gin/try_catch.h"
+
+#include "gin/converter.h"
+
+namespace gin {
+
+TryCatch::TryCatch() {
+}
+
+TryCatch::~TryCatch() {
+}
+
+bool TryCatch::HasCaught() {
+ return try_catch_.HasCaught();
+}
+
+std::string TryCatch::GetPrettyMessage() {
+ std::string info;
+ ConvertFromV8(try_catch_.Message()->Get(), &info);
+
+ std::string sounce_line;
+ if (ConvertFromV8(try_catch_.Message()->GetSourceLine(), &sounce_line))
+ info += "\n" + sounce_line;
+
+ return info;
+}
+
+} // namespace gin