Index: gin/try_catch.cc |
diff --git a/gin/try_catch.cc b/gin/try_catch.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..302d8bde7a6c6c58d059a91beaf59f67f25a300b |
--- /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 |