This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
forked from TiForward/HAL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJSError.hpp
60 lines (45 loc) · 1.46 KB
/
JSError.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* HAL
*
* Copyright (c) 2014 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License.
* Please see the LICENSE included with this distribution for details.
*/
#ifndef _HAL_JSERROR_HPP_
#define _HAL_JSERROR_HPP_
#include "HAL/JSValue.hpp"
#include "HAL/JSObject.hpp"
#include <vector>
#include <deque>
namespace HAL {
/*!
@class
@discussion A JavaScript object of the Error type.
The only way to create a JSError is by using the
JSContext::CreateError member function.
*/
class HAL_EXPORT JSError final : public JSObject HAL_PERFORMANCE_COUNTER2(JSError) {
public:
#pragma warning(push)
#pragma warning(disable : 4251)
static std::deque<std::string> NativeStack__;
static std::string GetNativeStack();
static void ClearNativeStack();
#pragma warning(pop)
std::string message() const;
std::string name() const;
std::string filename() const;
std::uint32_t linenumber() const;
std::string stack() const;
std::string nativeStack() const;
private:
// Only JSContext and JSObject can create a JSError.
friend JSContext;
friend JSObject;
JSError(const JSContext& js_context, const std::vector<JSValue>& arguments = {});
// For interoperability with the JavaScriptCore C API.
JSError(const JSContext& js_context, JSObjectRef js_object_ref);
static JSObjectRef MakeError(const JSContext& js_context, const std::vector<JSValue>& arguments);
};
} // namespace HAL {
#endif // _HAL_JSERROR_HPP_