blob: a1daaf1c4f029c0393db289053a2c1b642fd59d7 [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
[email protected]60531d52013-11-27 02:10:155#ifndef GIN_TRY_CATCH_H_
6#define GIN_TRY_CATCH_H_
[email protected]855ab432013-11-18 17:09:367
8#include <string>
9
avi90e658dd2015-12-21 07:16:1910#include "base/macros.h"
[email protected]48c21632013-12-12 21:32:3411#include "gin/gin_export.h"
[email protected]855ab432013-11-18 17:09:3612#include "v8/include/v8.h"
13
14namespace gin {
15
[email protected]60531d52013-11-27 02:10:1516// TryCatch is a convenient wrapper around v8::TryCatch.
[email protected]48c21632013-12-12 21:32:3417class GIN_EXPORT TryCatch {
[email protected]855ab432013-11-18 17:09:3618 public:
bashidbd2ef9bb2015-06-02 01:39:3219 explicit TryCatch(v8::Isolate* isolate);
[email protected]855ab432013-11-18 17:09:3620 ~TryCatch();
21
22 bool HasCaught();
[email protected]2f703422013-11-25 21:26:1523 std::string GetStackTrace();
[email protected]855ab432013-11-18 17:09:3624
25 private:
bashidbd2ef9bb2015-06-02 01:39:3226 v8::Isolate* isolate_;
[email protected]855ab432013-11-18 17:09:3627 v8::TryCatch try_catch_;
28
29 DISALLOW_COPY_AND_ASSIGN(TryCatch);
30};
31
32} // namespace gin
33
[email protected]60531d52013-11-27 02:10:1534#endif // GIN_TRY_CATCH_H_