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