[email protected] | 855ab43 | 2013-11-18 17:09:36 | [diff] [blame] | 1 | // 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] | 60531d5 | 2013-11-27 02:10:15 | [diff] [blame^] | 5 | #ifndef GIN_TRY_CATCH_H_ |
6 | #define GIN_TRY_CATCH_H_ | ||||
[email protected] | 855ab43 | 2013-11-18 17:09:36 | [diff] [blame] | 7 | |
8 | #include <string> | ||||
9 | |||||
10 | #include "base/basictypes.h" | ||||
11 | #include "v8/include/v8.h" | ||||
12 | |||||
13 | namespace gin { | ||||
14 | |||||
[email protected] | 60531d5 | 2013-11-27 02:10:15 | [diff] [blame^] | 15 | // TryCatch is a convenient wrapper around v8::TryCatch. |
[email protected] | 855ab43 | 2013-11-18 17:09:36 | [diff] [blame] | 16 | class TryCatch { |
17 | public: | ||||
18 | TryCatch(); | ||||
19 | ~TryCatch(); | ||||
20 | |||||
21 | bool HasCaught(); | ||||
[email protected] | 2f70342 | 2013-11-25 21:26:15 | [diff] [blame] | 22 | std::string GetStackTrace(); |
[email protected] | 855ab43 | 2013-11-18 17:09:36 | [diff] [blame] | 23 | |
24 | private: | ||||
25 | v8::TryCatch try_catch_; | ||||
26 | |||||
27 | DISALLOW_COPY_AND_ASSIGN(TryCatch); | ||||
28 | }; | ||||
29 | |||||
30 | } // namespace gin | ||||
31 | |||||
[email protected] | 60531d5 | 2013-11-27 02:10:15 | [diff] [blame^] | 32 | #endif // GIN_TRY_CATCH_H_ |