OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_RENDERER_API_LAST_ERROR_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_LAST_ERROR_H_ |
6 #define EXTENSIONS_RENDERER_API_LAST_ERROR_H_ | 6 #define EXTENSIONS_RENDERER_API_LAST_ERROR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 APILastError(APILastError&& other); | 26 APILastError(APILastError&& other); |
27 ~APILastError(); | 27 ~APILastError(); |
28 | 28 |
29 // Sets the last error for the given |context| to |error|. | 29 // Sets the last error for the given |context| to |error|. |
30 void SetError(v8::Local<v8::Context> context, const std::string& error); | 30 void SetError(v8::Local<v8::Context> context, const std::string& error); |
31 | 31 |
32 // Clears the last error in the given |context|. If |report_if_unchecked| is | 32 // Clears the last error in the given |context|. If |report_if_unchecked| is |
33 // true and the developer didn't check the error, this throws an exception. | 33 // true and the developer didn't check the error, this throws an exception. |
34 void ClearError(v8::Local<v8::Context> context, bool report_if_unchecked); | 34 void ClearError(v8::Local<v8::Context> context, bool report_if_unchecked); |
35 | 35 |
| 36 // Returns true if the given context has an active error. |
| 37 bool HasError(v8::Local<v8::Context> context); |
| 38 |
36 private: | 39 private: |
37 GetParent get_parent_; | 40 GetParent get_parent_; |
38 | 41 |
39 DISALLOW_COPY_AND_ASSIGN(APILastError); | 42 DISALLOW_COPY_AND_ASSIGN(APILastError); |
40 }; | 43 }; |
41 | 44 |
42 } // namespace extensions | 45 } // namespace extensions |
43 | 46 |
44 #endif // EXTENSIONS_RENDERER_API_LAST_ERROR_H_ | 47 #endif // EXTENSIONS_RENDERER_API_LAST_ERROR_H_ |
OLD | NEW |