blob: 302d8bde7a6c6c58d059a91beaf59f67f25a300b [file] [log] [blame]
[email protected]855ab432013-11-18 17:09:361// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "gin/try_catch.h"
6
7#include "gin/converter.h"
8
9namespace gin {
10
11TryCatch::TryCatch() {
12}
13
14TryCatch::~TryCatch() {
15}
16
17bool TryCatch::HasCaught() {
18 return try_catch_.HasCaught();
19}
20
21std::string TryCatch::GetPrettyMessage() {
22 std::string info;
23 ConvertFromV8(try_catch_.Message()->Get(), &info);
24
25 std::string sounce_line;
26 if (ConvertFromV8(try_catch_.Message()->GetSourceLine(), &sounce_line))
27 info += "\n" + sounce_line;
28
29 return info;
30}
31
32} // namespace gin